Open MS Excel Spreadsheet with Python

Antti Kaihola akaihola at ambi-spam-me-not-tone.com
Fri Jul 18 23:58:13 CEST 2003


There's an excellent utility called xlhtml, which converts XLS 
spreadsheets to HTML files, available at 
http://chicago.sourceforge.net/xlhtml/

I made a simple Python wrapper, which uses xlhtml and parses the 
converted spreadsheet into a Python Numeric array. As I didn't need to 
do any calculations with the data, you only get cell contents as string 
objects at this time.

Note that using this method you only need freely available tools, no 
excel or windows. Also, it isn't necessary to open and save the 
spreadsheet as a CSV or XML file, which is nice if you need to batch 
process lots of spreadsheets.

Take a look at akaihola.iki.fi/comp/python and drop me a note if you 
make improvements to the code.


Antti





More information about the Python-list mailing list