tags:

views:

274

answers:

3

Could someone provide the best way to read xls files with python (not csv files).

if there a built in package which supported by default with python to this this task ?

+3  A: 

There is no such built-in package that I know of.

But you may find this web page interesting: http://www.python-excel.org/

Olivier
A: 

You can use any of the libraries listed here (like Pyxlreader that is based on JExcelApi, or xlwt), plus COM automation to use Excel itself for the reading of the files, but for that you are introducing Office as a dependency of your software, which might not be always an option.

voyager
(1) pyxlreader is the absolute pox. You must not have ever tried it. See my comments here: http://stackoverflow.com/questions/1243545/programmatically-extract-data-from-an-excel-spreadsheet (2) `xlwt` WriTes files; use `xlrd` to ReaD files.
John Machin
+2  A: 

I highly recommend xlrd for reading xls files.

voyager mentioned the use of COM automation. Having done this myself a few years ago, be warned that doing this is a real PITA. The number of caveats is huge and the documentation is lacking and annoying. I ran into many wierd bugs and gotchas, some of which took many hours to figure out.

taleinat