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

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

Built distribution (wheel)

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

Total release size: 74.0 kB

Release files / pyodsstream-0.0.10.tar.gz

Download URL pyodsstream-0.0.10.tar.gz
Size 33.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4767dcd2b6928b2c9cd698567a6aa425f930670c2eb41f6aac5a3a902a8d5684
BLAKE2b-256 checksum
How to use checksums
86de198f3ae113248e46c6727f441464a15117d055ef7cd95827ffceb5054691
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.10-py3-none-any.whl

Download URL pyodsstream-0.0.10-py3-none-any.whl
Size 40.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3025a979a7965ee7b4d7e4a8d2fc0075f04264ce49f199ea5a75c79c7e540cf9
BLAKE2b-256 checksum
How to use checksums
e1e503eaa13c6cd2be4b9f54e0a2101fa832cdd05b9d929f139c02f89646dbeb
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.10 This release

2 release files

0.0.9

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