Read / Write OpenOffice SpreadSheet ?

Tim Chase python.list at tim.thechases.com
Thu Dec 16 21:08:27 EST 2010


On 12/16/2010 07:53 PM, Tim Harig wrote:
> On 2010-12-17, Torsten Mohr<tmohr at s.netic.de>  wrote:
>> i search for a possibility to access OpenOffoce SpreadSheets from Python
>> with a reasonably new version of Python.
>>
>> Can anybody point me to a package that can do this?
>
> There is no package needed to read or write the new open document files.
> The files are merely a jar archive containing XML files.  You can open
> and update them using jar as a subprocess and manipulate the XML files
> using your favorite XML libraries DOM/SAX/XPath/Etree/etc.

To make that even easier (no need for a subprocess launching a 
JAR tool), JAR files are just ZIP files (IIRC, they may have some 
particularly-named files for metadata purposes, but it's all just 
a big zip-blob), so you can use Python's native zipfile module to 
crack into it.  Then, as TimH suggests, wander around in the XML 
(and other files) inside.

-tkc






More information about the Python-list mailing list