ODS loader
Long story short, I needed to extract the cell contents (with row and column numbers) from ODS (OpenDocument Spreadsheet) files. Google gave me no usable results, so I wrote my own loader. It's written in Python, but it should be portable to C/C++/other languages fairly easily. I've tested it with Python 2.7.x. It almost works in Python 3, you just have to change one line in one function. I don't know how to make that happen automatically, as Python 3's way of doing Unicode is so different from Python 2 that I can't deal with them in one file.
This loader is very minimalistic. It supports multiple sheets, but loads only the cell data and cell coordinates. Sheet names and cell contents are stored in UTF-8. No other data is loaded. But the code is simple enough that you should be able to extend it to suit your needs.
Can be also used as a standalone script to dump ODS contents to console.
Download
ods.py
The parsertestods.zip
Some test files in case you want to make sure your changes didn't break anything. I used these files to test everything. They're not perfect, but they work.
History
- January 2012: Initial version, not public yet
- Summer/fall 2012: Unknown version, in public
- Spring 2013: Version 0.75, something was fixed
- August 4 2013: Version 0.76, some random fixes
- July 13 2015: Version 0.9, two new important things (cell repeating and getting around expat's annoying "features"). Also cleaned up the file a bit.
- July 16 2015: Version 0.91, added a missing shebang line. It got removed accidentally.
This "changelog" was first written in July 2015, so it's a bit sketchy about the details.