pyexcel-ods3
raw JSON → 0.6.1 verified Mon Apr 27 auth: no python
A wrapper library to read, manipulate and write data in ODS (Open Document Spreadsheet) format, version 0.6.1. It is part of the pyexcel ecosystem and requires Python 3.6+. Release cadence is low; last release was in 2020.
pip install pyexcel-ods3 Common errors
error ModuleNotFoundError: No module named 'pyexcel_ods3' ↓
cause Package not installed or incorrect import name.
fix
Install with: pip install pyexcel-ods3. Then import: from pyexcel_ods3 import get_data
error AttributeError: module 'pyexcel_ods3' has no attribute 'save' ↓
cause Using wrong function name (save instead of save_data).
fix
Use: from pyexcel_ods3 import save_data
Warnings
breaking In v0.6.0, the plugin system was revamped. If you upgraded from <0.6.0, you must reinstall or update pyexcel-io and pyexcel-ezodf. ↓
fix Run: pip install --upgrade pyexcel-ods3 pyexcel-io pyexcel-ezodf
gotcha pyexcel-ods3 uses dicts for sheet data; sheet names are dict keys. If the file has multiple sheets, the dict will have multiple entries. Iterating over dict values yields sheets as 2D lists. ↓
fix Always iterate over dict values or handle sheet names explicitly: for sheet_name, sheet_data in get_data('file.ods').items(): ...
deprecated Python 3.5 support was dropped in v0.6.0. pyexcel-ods3 now requires Python >=3.6. ↓
fix Use Python 3.6 or newer.
Imports
- get_data wrong
import pyexcel_ods3correctfrom pyexcel_ods3 import get_data - save_data wrong
from pyexcel_ods3 import savecorrectfrom pyexcel_ods3 import save_data
Quickstart
from pyexcel_ods3 import save_data, get_data
data = [[1, 2, 3], ['a', 'b', 'c']]
save_data('test.ods', data)
loaded = get_data('test.ods')
print(loaded)