Skip to main content

direct-formatting-pandas-ods-reader

pipeline status

Inspired from pandas-ods-reader, but with the ability to read direct formatting. pandas-ods-reader relies on ezodf to extract cell content, but ezodf ignores direct formatting, so we need to go at a lower level.

The direct (emphasis, strong, underline, subscript, superscript, and anchors) formatting is turned into markup in the resulting pandas DataFrame.

Dependencies

  • lxml
  • pandas

Usage

In a Python project

from direct_formatting_pandas_ods_reader import read_ods

# single global format
df = read_ods("test/test.ods")

df = read_ods("test/test.ods", format="markdown")

df = read_ods("test/test.ods", format="html", sheet=0)

# or per-column formats:
df = read_ods("test/test.ods", format={
    "Column 1": "markdown",
    "Column 3": "html"
})

The format argument can be:

  1. "html", "markdown", "asciidoc" or "none" (global format for all columns),
  2. or a dict mapping column labels to formats (unspecified column labels to "none")

sheet_index defaults to 0, which corresponds to the first sheet of the file.

Command-line usage

You can use this package as a CLI tool:

python -m direct_formatting_pandas_ods_reader input.ods -o output.csv -t html
  • input.ods path to the ODS file (required).
  • -o, --output output CSV file (if omitted, writes to standard output).
  • -t, --type output format for formatting marks (asciidoc, markdown, html). Defaults to asciidoc.
  • -s, --sheet index of the sheet to read (0-based, default: 0).

Install as a global CLI tool

pip install -e .

This creates a global direct-formatting-ods-to-csv command:

direct-formatting-ods-to-csv input.ods -t markdown

License

Licensed under the GNU GPL v3.0, Yann Trividic.

Metadata

Release files for direct-formatting-pandas-ods-reader 0.5.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for direct-formatting-pandas-ods-reader 0.5.3
File Size Uploaded
direct_formatting_pandas_ods_reader-0.5.3.tar.gz 46.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for direct-formatting-pandas-ods-reader 0.5.3
File Interpreter ABI Platform
direct_formatting_pandas_ods_reader-0.5.3-py3-none-any.whl Python 3 none any Details

Total release size: 80.1 kB

Release files / direct_formatting_pandas_ods_reader-0.5.3.tar.gz

Download URL direct_formatting_pandas_ods_reader-0.5.3.tar.gz
Size 46.2 kB
Tags Source
SHA-256 checksum
How to use checksums
849086bfb78d9c55b4a66428459e4a4ddf31a61f7cb231e2db1a01161e863196
BLAKE2b-256 checksum
How to use checksums
efd776d6e59e88e9601a6e889a3c903ea7b6e62138c31bcd7eba8d563b004d2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / direct_formatting_pandas_ods_reader-0.5.3-py3-none-any.whl

Download URL direct_formatting_pandas_ods_reader-0.5.3-py3-none-any.whl
Size 34.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d50bb96b4f0207df7163c1cf4cc4f5bdb35273f0dcb4a81b83a9aca87ece261a
BLAKE2b-256 checksum
How to use checksums
ca6e586d6e2d1a99f35d82ea8387eed1c407b309e97dbaba1a67c82c37c0a6c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release history Release notifications | RSS feed

This release

0.5.3 This release

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.4

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page