odsparsator


Nameodsparsator JSON
Version 1.12.1 PyPI version JSON
download
home_pagehttps://github.com/jdum/odsparsator
SummaryGenerate a json file from an OpenDocument Format .ods file
upload_time2024-10-14 18:38:06
maintainerNone
docs_urlNone
authorJérôme Dumonteil
requires_python<4,>=3.9
licenseMIT
keywords opendocument odf ods json spreadsheet parser
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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 `Python3` package, using the [odfdo](https://github.com/jdum/odfdo) library. Current version requires Python >= 3.9, see prior versions for older environments.

Project:
    https://github.com/jdum/odsparsator

Author:
    jerome.dumonteil@gmail.com

License:
    MIT


## Installation

Installation from Pypi (recommended):


```python
pip install odsparsator
```

Installation from sources (requiring setuptools):

```python
pip install .
```

## 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
------

```sh
$ odsparsator --minimal sample.ods sample_minimal.json
```

The result:

```python
{
    "body": [
        {
            "name": "first tab",
            "table": [
                ["a", "b", "c"],
                [10, 20, 30]
            ]
        }
    ]
}
```

Without the --minimal option:

```sh
$ odsparsator sample.ods sample_with_styles.json
```

The result:

```python

{
"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


```python
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).


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jdum/odsparsator",
    "name": "odsparsator",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4,>=3.9",
    "maintainer_email": null,
    "keywords": "openDocument, ODF, ods, json, spreadsheet, parser",
    "author": "J\u00e9r\u00f4me Dumonteil",
    "author_email": "jerome.dumonteil@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/06/01/2e4a86a793c55a6260d892473b25a726972d6b1b0361602ff48eafb17b78/odsparsator-1.12.1.tar.gz",
    "platform": null,
    "description": "# odsparsator, a .ods parser.\n\nGenerate a JSON file from an OpenDocument Format `.ods` file.\n\nWhen used as a script, `odsparsator` parses a `.ods` file and generates a JSON\nfile using the `odfdo` library.\n\nWhen used as a library, `odsparsator` parses a `.ods` file and returns a Python\nstructure.\n\nThe resulting data follows the format of the reverse `odsgenerator.py` script,\nsee https://github.com/jdum/odsgenerator\n\n\n`odsparsator` is a `Python3` package, using the [odfdo](https://github.com/jdum/odfdo) library. Current version requires Python >= 3.9, see prior versions for older environments.\n\nProject:\n    https://github.com/jdum/odsparsator\n\nAuthor:\n    jerome.dumonteil@gmail.com\n\nLicense:\n    MIT\n\n\n## Installation\n\nInstallation from Pypi (recommended):\n\n\n```python\npip install odsparsator\n```\n\nInstallation from sources (requiring setuptools):\n\n```python\npip install .\n```\n\n## CLI usage\n\n```\nodsparsator [-h] [--version] [options] input_file output_file\n```\n\n### arguments\n\n`input_file`: input file, a .ods file.\n\n`output_file`: output file, JSON file generated from input.\n\nUse ``odsparsator --help`` for options:\n\n```\noptions:\n  -h, --help         show this help message and exit\n  --version          show program's version number and exit\n  -m, --minimal      keep only rows and cells, no styles, no formula, no column width\n  -a, --all-styles   collect all styles from the input\n  -c, --color        collect background color of cells\n  -k, --keep-styled  keep styled cells with empty value\n  -s, --see-hidden   parse also the hidden sheets\n\n```\n\n\n### sample\n------\n\n```sh\n$ odsparsator --minimal sample.ods sample_minimal.json\n```\n\nThe result:\n\n```python\n{\n    \"body\": [\n        {\n            \"name\": \"first tab\",\n            \"table\": [\n                [\"a\", \"b\", \"c\"],\n                [10, 20, 30]\n            ]\n        }\n    ]\n}\n```\n\nWithout the --minimal option:\n\n```sh\n$ odsparsator sample.ods sample_with_styles.json\n```\n\nThe result:\n\n```python\n\n{\n\"body\": [\n    {\n        \"name\": \"first tab\",\n        \"table\": [\n            {\n                \"row\": [\n                    {\n                        \"value\": \"a\",\n                        \"style\": \"bold_center_bg_gray_grid_06pt\"\n                    },\n                    {\n                        \"value\": \"b\",\n                        \"style\": \"bold_center_bg_gray_grid_06pt\"\n                        ...\n```\n\n\n## Usage from python code\n\n\n```python\nfrom odsparsator import odsparsator\n\ncontent = odsparsator.ods_to_python(\"sample1.ods\")\n```\n\n\n## Documentation\n\nSee in the `./doc` folder:\n\n\n`html/odsparsator.html`\n\n\n## License\n\nThis project is licensed under the MIT License (see the\n`LICENSE` file for details).\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Generate a json file from an OpenDocument Format .ods file",
    "version": "1.12.1",
    "project_urls": {
        "Homepage": "https://github.com/jdum/odsparsator",
        "Repository": "https://github.com/jdum/odsparsator"
    },
    "split_keywords": [
        "opendocument",
        " odf",
        " ods",
        " json",
        " spreadsheet",
        " parser"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "648a712f0b270bc43c9add68fa193cc18d8632fa1eec86a37a8b1dca66b105d0",
                "md5": "1ab5fe122f03597956488a3be36b2fe1",
                "sha256": "816c2f03383644cc4b8328c34716a09c8209eba9b63c9a7a9774ea4beea04028"
            },
            "downloads": -1,
            "filename": "odsparsator-1.12.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1ab5fe122f03597956488a3be36b2fe1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.9",
            "size": 8797,
            "upload_time": "2024-10-14T18:38:05",
            "upload_time_iso_8601": "2024-10-14T18:38:05.724620Z",
            "url": "https://files.pythonhosted.org/packages/64/8a/712f0b270bc43c9add68fa193cc18d8632fa1eec86a37a8b1dca66b105d0/odsparsator-1.12.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "06012e4a86a793c55a6260d892473b25a726972d6b1b0361602ff48eafb17b78",
                "md5": "75e7f33237b3df7350382db12c4db8da",
                "sha256": "6e4dac267711e332dd4eaf21e4645ad96bcae6370adb180730f41ca764070279"
            },
            "downloads": -1,
            "filename": "odsparsator-1.12.1.tar.gz",
            "has_sig": false,
            "md5_digest": "75e7f33237b3df7350382db12c4db8da",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.9",
            "size": 8756,
            "upload_time": "2024-10-14T18:38:06",
            "upload_time_iso_8601": "2024-10-14T18:38:06.671337Z",
            "url": "https://files.pythonhosted.org/packages/06/01/2e4a86a793c55a6260d892473b25a726972d6b1b0361602ff48eafb17b78/odsparsator-1.12.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-14 18:38:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jdum",
    "github_project": "odsparsator",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "odsparsator"
}
        
Elapsed time: 0.40505s