Converting a xls file into csv file using Python

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • parthpatel
    New Member
    • Apr 2007
    • 14

    Converting a xls file into csv file using Python

    Hello,

    I m trying to convert a xls file data into csv type data.

    Is it possible anyway that i can do this using python coding

    if yes than plz provide a demo code for this

    Thanks
  • ghostdog74
    Recognized Expert Contributor
    • Apr 2006
    • 511

    #2
    Originally posted by parthpatel
    Hello,

    I m trying to convert a xls file data into csv type data.

    Is it possible anyway that i can do this using python coding

    if yes than plz provide a demo code for this

    Thanks
    there are modules you can download, eg pyexcelerator that can do simple excel manipulations. See its docs for more examples.

    Comment

    • bartonc
      Recognized Expert Expert
      • Sep 2006
      • 6478

      #3
      Originally posted by parthpatel
      Hello,

      I m trying to convert a xls file data into csv type data.

      Is it possible anyway that i can do this using python coding

      if yes than plz provide a demo code for this

      Thanks
      If you know enough Visual Basic, you can use win32com.client to send Excel the commands. Acutally, If you record a macro of the task you can figure out what commands to send with the added ability to specify the file names, etc.

      Comment

      • shahjapan
        New Member
        • Apr 2007
        • 63

        #4
        Originally posted by bartonc
        If you know enough Visual Basic, you can use win32com.client to send Excel the commands. Acutally, If you record a macro of the task you can figure out what commands to send with the added ability to specify the file names, etc.
        some readymade scripts are availbale for python to convert the excel to csv.

        but thats is not the point.

        point is that we want to convert the csv file anyway in such a format that python can read whole file accuretly,

        it can be generated from any soft.

        or we need to set some argument in python so DictReader can read the values including special characters and including new lines,etc

        Comment

        • shahjapan
          New Member
          • Apr 2007
          • 63

          #5
          Originally posted by shahjapan
          some readymade scripts are availbale for python to convert the excel to csv.

          but thats is not the point.

          point is that we want to convert the csv file anyway in such a format that python can read whole file accuretly,

          it can be generated from any soft.

          or we need to set some argument in python so DictReader can read the values including special characters and including new lines,etc

          I also have the same problem reading CSV file under python and it fails when any column data has multiline text

          Comment

          • shahjapan
            New Member
            • Apr 2007
            • 63

            #6
            Originally posted by bartonc
            If you know enough Visual Basic, you can use win32com.client to send Excel the commands. Acutally, If you record a macro of the task you can figure out what commands to send with the added ability to specify the file names, etc.

            you may read the link below for this problem

            Python Bug



            Comment

            • shahjapan
              New Member
              • Apr 2007
              • 63

              #7
              Originally posted by shahjapan
              you may read the link below for this problem

              Python Bug



              http://mail.python.org/pipermail/pyt...ne/033867.html
              problem is solved by just saving the csv file again with the TEXT DELIMINATOR = " and seprated by ,

              Comment

              • bartonc
                Recognized Expert Expert
                • Sep 2006
                • 6478

                #8
                Originally posted by shahjapan
                problem is solved by just saving the csv file again with the TEXT DELIMINATOR = " and seprated by ,
                Thank you so much for keeping us up-to-date on this issue.

                Comment

                Working...