Edit page in Livemark
(2022-09-19 18:33)

Ods Format

Frictionless supports ODS parsing.

pip install frictionless[ods]
pip install 'frictionless[ods]' # for zsh shell

Reading Data

You can read this format using Package/Resource, for example:

from pprint import pprint
from frictionless import Resource

resource = Resource(path='table.ods')
pprint(resource.read_rows())
[{'id': 1, 'name': 'english'}, {'id': 2, 'name': '中国人'}]

Writing Data

The same is actual for writing:

from pprint import pprint
from frictionless import Resource

source = Resource(data=[['id', 'name'], [1, 'english'], [2, 'german']])
target = source.write('table-output.ods')
pprint(target)

Configuration

There is a dialect to configure how Frictionless read and write files in this format. For example:

from frictionless import Resource, formats

resource = Resource(data=[['id', 'name'], [1, 'english'], [2, 'german']])
resource.write('table-output-sheet.ods', control=formats.OdsControl(sheet='My Table'))

Reference

formats.OdsControl (class)

formats.OdsControl (class)

Ods control representation

Signature

(*, title: Optional[str] = None, description: Optional[str] = None, sheet: Union[str, int] = 1) -> None

Parameters

  • title (Optional[str])
  • description (Optional[str])
  • sheet (Union[str, int])

formats.odsControl.sheet (property)

NOTE: add docs

Signature

Union[str, int]

It's a beta version of Frictionless Framework (v5). Read Frictionless Framework (v4) docs for a version that is currently installed by default by pip.