Skip to main content

pyodsstream

Simple python API to handle ODS and tabulated files as streams. It provides lazy methods to read and write Open Document Spreadsheet or TSV files saving memory: data can be treated on the fly without having to load the entire tables.

Simple usage: write an ODS file

from pyodsstream import OdsDocWriter

ods_file = "test.ods"
with open(ods_file, "wb") as fp:
    writer = OdsDocWriter(fp)
    writer.write_sheet("This is a new sheet")
    writer.write_cell("This is a cell")
    writer.write_cell(15)
    writer.write_line()
    writer.write_cell("This is a cell on the second line")
    writer.close()

Simple usage: read this ODS file

from pyodsstream import OdsDocReader

ods_file = "test.ods"
reader = OdsDocReader()
with open(ods_file, "rb") as fp:
    reader.parse(fp)
    for sheet_line in reader.yield_sheet_lines():
        # sheet_line is a dictionnary:
        # {'sheet': 'This is a new sheet', 'line': ['This is a cell', 15.0]}
        if sheet_line["sheet"] == "This is a new sheet" and reader.line_position() == 0:
            assert sheet_line["line"][0] == 'This is a "cell with a quote'

Write your table to any CalcWriterInterface

from pyodsstream import CalcWriterInterface, OdsDocWriter, TsvDirectoryWriter

def write_your_table(writer: CalcWriterInterface):
    writer.write_sheet("This is a new sheet")
    writer.write_cell("This is a cell")
    writer.write_cell(15)
    writer.write_line()
    writer.write_cell("This is a cell on the second line")
    writer.close()


ods_file = "test.ods"
with open(ods_file, "wb") as fp:
    writer = OdsDocWriter(fp)
    write_your_table(writer)

tsv_directory = "test.d"
writer = TsvDirectoryWriter(tsv_directory)
write_your_table(writer)

Metadata

Release files for pyodsstream 0.0.9

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

Source distribution (sdist)

Source distribution for pyodsstream 0.0.9
File Size Uploaded
pyodsstream-0.0.9.tar.gz 33.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyodsstream 0.0.9
File Interpreter ABI Platform
pyodsstream-0.0.9-py3-none-any.whl Python 3 none any Details

Total release size: 73.8 kB

Release files / pyodsstream-0.0.9.tar.gz

Download URL pyodsstream-0.0.9.tar.gz
Size 33.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ef1c10f347622848cc7e28490da2de374e3762a62a7acc2bad3f7a44f0c0b2f5
BLAKE2b-256 checksum
How to use checksums
56f56ed85d9717cc57fb0b955c91656277ae0649aae882f26d18ee6e25634bf7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release files / pyodsstream-0.0.9-py3-none-any.whl

Download URL pyodsstream-0.0.9-py3-none-any.whl
Size 40.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe58af6bfe389d2b0f31b0dcf35c5ac355fad0259d2cf3bec9534a29d187a4e9
BLAKE2b-256 checksum
How to use checksums
4cd7141d3d10e8146e1678692d9a5ba378cff379cb3913be4d9cb6ea3e82e594
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release history Release notifications | RSS feed

0.0.11

2 release files

This release

0.0.9 This release

2 release files

0.0.8

2 release files

0.0.7

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