Python function to construct an ODS spreadsheet on the fly - without having to store the entire file in memory or disk
Project description
stream-write-ods
Python function to construct an ODS spreadsheet on the fly - without having to store the entire file in memory or disk
Installation
pip install stream-write-ods
Usage
def get_sheets():
def get_rows_of_sheet_1():
yield 'Value A', 'Value B'
yield 'Value C', 'Value D'
yield 'Sheet 1 name', ('col_1_name', 'col_2_name'), get_rows_of_sheet_1()
def get_rows_of_sheet_2():
yield 'col_1_value',
yield 'Sheet 2 name', ('col_1_name',), get_rows_of_sheet_2()
ods_chunks = stream_write_ods(get_sheets())
Types
There are 8 possible data types in an Open Document Spreadsheet: boolean, currency, date, float, percentage, string, time, and void. 4 of these can be output by stream-write-ods, chosen automatically according to the following table.
Python type | ODS type |
---|---|
boolean | boolean |
date | date - without time component |
datetime | date - with time component |
int | float |
float | float |
str | string |
NoneType | string - as #NA |
Limitations
ODS spreadsheets are essentially ZIP archives containing several member files. While in general ZIP archives can be up to 16EiB (exbibyte) in size using ZIP64, LibreOffice does not support ZIP64, and so ODS files are de-facto limited to 4GiB (gibibyte). This limit applies to the size of the entire compressed archive, the compressed size of each member file, and the uncompressed size of each member file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for stream_write_ods-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6528d7785d6869be5967310ce589f19043cac79796a6966cb0bd84f275100b54 |
|
MD5 | a0f3dbd13f50326c898951bdac704b82 |
|
BLAKE2b-256 | 1134097c3c36341f78dbdade065494391bd98fdc761dad2a551f297d9f24ac82 |