OdsReader uses odfpy to extract data from an .ods document (OpenOffice.org spreadsheet).
Thanks to Marco Conti and gtr for their blog post Read an ODS file with Python and Odfpy which was a valuable source of inspiration to me. Unlike Marco's reader this one doesn't store any data in memory, it just loops over the rows.
OdsReader is used to import data from .ods files into a Django database using a The Python serializer fixture, but not limited to this usage.
State : works for me, but very young and probably full of bugs.
Usage example in Lino utilities.
Abstract base class.
- class lino.utils.odsreader.SimpleOdsReader(**kw)¶
Abstract base class. For each .ods file you are probably creating a subclass of this.
- filename = None¶
The full path name of the .ods file to be read.
- headers = None¶
A list of unicode strings, one for each column in the file. The headers specified here must match exactly those found in the .ods file.
This will be called for each recognized data row and may perform a conversion before yielding it. Subclasses may override this.
Yields the data rows found in this .ods file.