Reading/parsing Excel (xls) files with Python


Question

What is the best way to read Excel (XLS) files with Python (not CSV files).

Is there a built-in package which is supported by default in Python to do this task?

1
105
8/4/2012 11:27:49 PM

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 weird bugs and gotchas, some of which took many hours to figure out.

UPDATE: For newer .xlsx files, the recommended library for reading and writing appears to be openpyxl (thanks, Ikar Pohorsk√Ĺ).

88
4/23/2019 12:41:51 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon