Install & Compatibility
Where this runs
tested against v0.3.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.6MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.5s · import 0.000s · 20MB
17MB installed
● package 17MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
newdoc
✓ from ezodf import newdoc
✗ from ezodf import newdoc
This quickstart demonstrates how to create both a new OpenDocument Text (.odt) file with a heading and paragraphs, and a new OpenDocument Spreadsheet (.ods) file with a sheet, cell values, and a basic formula. It then saves both documents.
from ezodf import newdoc, Paragraph, Heading, Sheet
import os
# Create a new text document (.odt)
odt_doc = newdoc(doctype='odt', filename='text_document.odt')
odt_doc.body += Heading("Chapter 1 - Introduction")
odt_doc.body += Paragraph("This is the first paragraph of the document.")
odt_doc.body += Paragraph("Here is some more text.")
odt_doc.save()
print(f"Text document saved to {os.path.abspath('text_document.odt')}")
# Create a new spreadsheet document (.ods)
ods_doc = newdoc(doctype='ods', filename='spreadsheet_document.ods')
sheet = Sheet('MySheet', size=(5, 5)) # Create a sheet named 'MySheet' with 5x5 cells
ods_doc.sheets += sheet
sheet['A1'].set_value("Product Name")
sheet['B1'].set_value("Quantity")
sheet['C1'].set_value("Price")
sheet['A2'].set_value("Laptop")
sheet['B2'].set_value(2)
sheet['C2'].set_value(1200, currency='USD')
sheet['D4'].formula = "of:=SUM([.B2];[.C2])" # Example formula, ezodf has no calculation engine
ods_doc.save()
print(f"Spreadsheet document saved to {os.path.abspath('spreadsheet_document.ods')}")
# To open and modify an existing document (example)
# from ezodf import opendoc
# existing_doc = opendoc('text_document.odt')
# existing_doc.body.append(Paragraph('Added a new paragraph after opening.'))
# existing_doc.saveas('updated_text_document.odt')
Debug
Known issues
gotchaezodf does NOT include a calculation engine for spreadsheets. Formulas are stored as strings only. Changes like inserting/deleting rows/columns will NOT update cell references in formulas and can break them, requiring manual recalculation or external tools.fixBe aware that formulas are static text. For dynamic calculations, use another library or process the ODF file with a dedicated spreadsheet application.
affects: All versions (0.x)
gotchaWhen opening spreadsheet documents, `ezodf` uses 'expand strategies' to prevent memory overflows. The default strategy ('all_less_maxcount') may not accurately represent the original sheet layout and can potentially break cell references, especially with many repeated rows/columns. The 'all' strategy guarantees layout but can lead to memory issues for large files.fixConfigure the `ezodf.config.set_table_expand_strategy()` if you encounter layout issues or memory problems. Understand the trade-offs between 'all', 'all_but_last', and 'all_less_maxcount'.
affects: All versions (0.x)
deprecatedThe primary `ezodf` package on PyPI (0.3.2) has not seen updates since December 2015 and is marked as 'Alpha' development status. Active maintenance appears to have shifted to forks like `pyexcel-ezodf` or related projects.fixFor new projects or if you require ongoing support and updates, consider evaluating `pyexcel-ezodf` or other actively maintained ODF manipulation libraries that may build upon or offer alternatives to `ezodf`.
affects: 0.3.2 and older
gotchaThere are reported `SyntaxWarning: invalid escape sequence` issues with Python 3.13, indicating potential compatibility problems with very recent Python versions due to the library's age.fixTest thoroughly with your target Python version. If issues arise, consider using an older, compatible Python 3.x version or migrating to a more actively maintained library.
affects: Potentially Python 3.13+
Upgrade
Version history
0.3.2latest on PyPI · released Dec 14, 2015
Audit
Dependencies
lxmlrequiredRequired for painless XML serialization with prefix declaration.