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.8

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.8
File Size Uploaded
pyodsstream-0.0.8.tar.gz 33.3 kB Details

Built distribution (wheel)

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

Total release size: 73.8 kB

Release files / pyodsstream-0.0.8.tar.gz

Download URL pyodsstream-0.0.8.tar.gz
Size 33.3 kB
Tags Source
SHA-256 checksum
How to use checksums
baace0e7e004af4c2b43ebce36faeefbad95482c0b72a36c535db4828a2b0e62
BLAKE2b-256 checksum
How to use checksums
738b34585fbfe74a10accfcc83165be1ccefad41948d9b10aec255c5e306c9f5
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.8-py3-none-any.whl

Download URL pyodsstream-0.0.8-py3-none-any.whl
Size 40.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae139e28d46bd1354f96a966bd04a11d7fed207f60d6da744edb296ededdfaaa
BLAKE2b-256 checksum
How to use checksums
394ecff843d846af2d5cacbaaf172e54e18906161be2c3b31612effc98ebcafe
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

0.0.9

2 release files

This release

0.0.8 This release

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