Reading MS Excel Files ?

Les Schaffer schaffer.SPAM at optonline.net
Tue Nov 26 10:21:23 EST 2002


Peter Skipworth wrote:

> Quite a few of the scripts I develop need to be able to parse a
> Microsoft Excel spreadsheet - with Perl, this was quite simple, using a
> module called Spreadsheet::ParseExcel. Does anything similar exist for
> Python ?

well, its not pretty but it works fine:

run xlhtml on your spreadsheet to produce an html table, then run w3m on 
that html to get the data

        result = os.popen( "/usr/bin/xlhtml -te %s > %s" % \
                           ( excelFile, tempFile ) ).close()
...

        sheet = os.popen( '/usr/bin/w3m -dump %s' % tempFile )

w3m's output is lines for rows, and '|' seperating columns. works fine for 
me.

les schaffer



More information about the Python-list mailing list