Generate a json file from an OpenDocument Format .ods file
Project description
odsparsator, a .ods parser.
Generate a JSON file from an OpenDocument Format .ods file.
When used as a script, odsparsator parses a .ods file and generates a JSON
file using the odfdo library.
When used as a library, odsparsator parses a .ods file and returns a Python
structure.
The resulting data follows the format of the reverse odsgenerator.py script,
see https://github.com/jdum/odsgenerator
odsparsator 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/odsparsator
Author: jerome.dumonteil@gmail.com
License: MIT
Installation
Installation from Pypi (recommended):
pip install odsparsator
Installation from sources:
uv sync
CLI usage
odsparsator [-h] [--version] [options] input_file output_file
arguments
input_file: input file, a .ods file.
output_file: output file, JSON file generated from input.
Use odsparsator --help for options:
options:
-h, --help show this help message and exit
--version show program's version number and exit
-m, --minimal keep only rows and cells, no styles, no formula, no column width
-a, --all-styles collect all styles from the input
-c, --color collect background color of cells
-k, --keep-styled keep styled cells with empty value
-s, --see-hidden parse also the hidden sheets
sample
$ odsparsator --minimal sample.ods sample_minimal.json
The result:
{
"body": [
{
"name": "first tab",
"table": [
["a", "b", "c"],
[10, 20, 30]
]
}
]
}
Without the --minimal option:
$ odsparsator sample.ods sample_with_styles.json
The result:
{
"body": [
{
"name": "first tab",
"table": [
{
"row": [
{
"value": "a",
"style": "bold_center_bg_gray_grid_06pt"
},
{
"value": "b",
"style": "bold_center_bg_gray_grid_06pt"
...
Usage from python code
from odsparsator import odsparsator
content = odsparsator.ods_to_python("sample1.ods")
Documentation
See in the ./doc folder:
html/odsparsator.html
License
This project is licensed under the MIT License (see the
LICENSE file for details).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file odsparsator-1.14.0.tar.gz.
File metadata
- Download URL: odsparsator-1.14.0.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7852fe148ab9edd39678ec0e936d1a2f0510d9d6abddfe64b6148c2e4821e6f8
|
|
| MD5 |
9fb7619211cdcd4cbc4b14c9bd65e880
|
|
| BLAKE2b-256 |
d94a7393b57f6aa01845bf6c21e3745f0f99148b98733acba65e9ab277a3ca42
|
File details
Details for the file odsparsator-1.14.0-py3-none-any.whl.
File metadata
- Download URL: odsparsator-1.14.0-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d2e743de10ea62a9f4e4c1baf5ffb5c54cd6beef2608bb16f502ecaa008e01c
|
|
| MD5 |
c7dea4e003606e28627cfb31a946467d
|
|
| BLAKE2b-256 |
6ce0ba59e8f708b9bf53b12c97fb24285d1ca31984d3eb9e42d848fa73034b34
|