odsgenerator, a .ods generator.
Generate an OpenDocument Format .ods file from a .json or .yaml file.
When used as a script, odsgenerator parses a JSON or YAML description of
tables and generates an ODF document using the odfdo library.
When used as a library, odsgenerator parses a Python description of tables
and returns the ODF content as bytes (ready to be saved as a valid ODF document).
- The content description can be minimalist: a list of lists of lists,
- or description can be complex, allowing styles at row or cell level.
See also https://github.com/jdum/odsparsator which is doing the reverse
operation, .osd to .json.
odsgenerator is a Python package, using the odfdo library. Current version requires Python >= 3.10, see prior versions for older environments.
Project: https://github.com/jdum/odsgenerator
Author: jerome.dumonteil@gmail.com
License: MIT
Installation
Installation from Pypi (recommended):
pip install odsgenerator
Installation from sources:
uv sync
CLI usage
odsgenerator [-h] [--version] [-l LANGUAGE] input_file output_file
arguments
-l, --lang: force document language (e.g. en-US, fr-FR)
input_file: input file containing data in JSON or YAML format
output_file: output file, .ods file generated from the input
Use odsgenerator --help for more details about input file parameters
and look at examples in the tests folder.
Usage from python code
from odsgenerator import odsgenerator
content = odsgenerator.ods_bytes([[["a", "b", "c"], [10, 20, 30]]])
with open("sample.ods", "wb") as file:
file.write(content)
The resulting .ods file loaded in a spreadsheet:
Another example with more parameters:
import odsgenerator
content = odsgenerator.ods_bytes(
[
{
"name": "first tab",
"style": "cell_decimal2",
"table": [
{
"row": ["a", "b", "c"],
"style": "bold_center_bg_gray_grid_06pt",
},
[10, 20, 30],
],
}
]
)
with open("sample2.ods", "wb") as file:
file.write(content)
The .ods file loaded in a spreadsheet, with gray background on first line:
Principle
- A document is a list or dict containing tabs. If a dict is provided, optional keys include
language(e.g."en-US"),styles,default_styles,common_styles,defaults, andbody. - a tab is a list or dict containing rows,
- a row is a list or dict containing cells.
Documentation
See in the `./doc folder:
html/odsgenerator.htmltutorial.jsonortutorial.ymlandtutorial.ods
License
This project is licensed under the MIT License (see the
LICENSE file for details).
Metadata
Release files for odsgenerator 1.18.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| odsgenerator-1.18.0.tar.gz | 10.9 kB | Without provenance | Details for odsgenerator-1.18.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| odsgenerator-1.18.0-py3-none-any.whl | Python 3 | none | any | Details for odsgenerator-1.18.0-py3-none-any.whl |
Total release size: 23.0 kB
Release files / odsgenerator-1.18.0.tar.gz
| Download URL | odsgenerator-1.18.0.tar.gz |
|---|---|
| Size | 10.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
51bfb9e30df98780168fdbb8f7aec4eea85d4f87a50c90afba20b50ebf9e7902
|
|
BLAKE2b-256 checksum How to use checksums |
163cf925a783985e956d44a182f9e6b668ede216dbe9519b2fcd2b3ab2226e90
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Release files / odsgenerator-1.18.0-py3-none-any.whl
| Download URL | odsgenerator-1.18.0-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
963e185a169f654f480070a775a3430147f3f6f0b328b350c2f2b4cfc9e94e50
|
|
BLAKE2b-256 checksum How to use checksums |
43601ed978fdb72fd6cd210060da047e7f0087608b8d3014a6a7ed57b7cff844
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Security for odsgenerator 1.18.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.