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.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyodsstream-0.0.11.tar.gz | 33.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyodsstream-0.0.11-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 74.3 kB
Release files / pyodsstream-0.0.11.tar.gz
| Download URL | pyodsstream-0.0.11.tar.gz |
|---|---|
| Size | 33.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
af0ce3baf6c83a34afb274c5294b3808a818230f9b5dca69917512ba01a5fa02
|
|
BLAKE2b-256 checksum How to use checksums |
dffd324061a0d46da9d77188a1ffa822bb92b5f3b70f22b98a548588758ccd12
|
| 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.11-py3-none-any.whl
| Download URL | pyodsstream-0.0.11-py3-none-any.whl |
|---|---|
| Size | 40.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1df75756b81d466738e9a7036b54e40eed987a54b765d31718d7db03fa071dd7
|
|
BLAKE2b-256 checksum How to use checksums |
2927c93ce44fc90565d7cc0f2aeb79d75a462034681be8d53061d3ed551c46b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|