[Qgis-user] Re: new xytools plugin: now open and save simple Excel files
Richard Duivenvoorde
rdmailings at duif.net
Fri Dec 16 08:50:08 PST 2011
On 2011-12-16 16:19, gene wrote:
> No, there is no need to PyUno and OpenOffice installed. Odt files are simple
> zipped files. The data are contained in a file named "content.xml" in the
> odt archive
>
> import zipfile
> from xml.etree import ElementTree as ET
> z = zipfile.ZipFile('mycalc.odt')
> file= z.read('content.xml')
> data = ET.parse(file)
> rows =
> data.findall('.//{urn:oasis:names:tc:opendocument:xmlns:table:1.0}table-row')
> etc.
Ok, tried this (with some adjustments).
Seems doable to read a spreadsheet from an ods file in this way. Though
I think it is harder to write it away in the same way :-(
Also tried the python-uno way. That's harder... Some strange things
going on there (like after running my scripts I cannot view libreoffice
programs anymore because soffice.bin runs 'invisible'...)
Anyway: both ways are doable, it will only cost some time. We could even
do both in qgis: first try the uno way, and if that fails take the xml
path (is xml a standard lib in windows?).
Feel free to add/try something.
Regards,
Richard Duivenvoorde
More information about the Qgis-user
mailing list