Skip to main content

aioxlsxstream

Generate the xlsx file on fly without storing entire file in memory. Generated excel workbook contain only one sheet. All data writes as strings.

Installation

pip install aioxlsxstream

Requirements

  • Python 3.8+

Simple exapmle

import aioxlsxstream
import asyncio

async def main():
    async def rows_generaor():
        async def row_cells_generator(row):
            for col in range(5):
                yield row*5 + col
        for row in range(10):
            yield row_cells_generator(row)

    xlsx_file = aioxlsxstream.XlsxFile()
    xlsx_file.write_sheet(rows_generaor())

    with open("example.xlsx", "wb") as f:
        async for data in xlsx_file:
            f.write(data)

asyncio.run(main())

aiohttp Example

from aiohttp import web, hdrs
import aioxlsxstream

async def rows_generaor():
    async def row_cells_generator(row):
        for col in range(5):
            yield row*5 + col
    for row in range(10):
        yield row_cells_generator(row)

async def handle(request):
    filename = "example.xlsx"
    response = web.StreamResponse(
        status=200,
        headers={
            hdrs.CONTENT_TYPE: "application/octet-stream",
            hdrs.CONTENT_DISPOSITION: (f"attachment; " f'filename="{filename}"; '),
        },
    )
    await response.prepare(request)

    xlsx_file = aioxlsxstream.XlsxFile() # or CsvFile("csv") or CsvFile("tsv")
    xlsx_file.write_sheet(rows_generaor())

    async for data in xlsx_file:
        await response.write(data)
    return response

app = web.Application()
app.add_routes([web.get('/', handle)])

if __name__ == '__main__':
    web.run_app(app)

Metadata

Release files for aioxlsxstream 1.0.3

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

Source distribution (sdist)

Source distribution for aioxlsxstream 1.0.3
File Size Uploaded Provenance Actions
aioxlsxstream-1.0.3.tar.gz 20.6 kB Without provenance Details for aioxlsxstream-1.0.3.tar.gz

Built distribution (wheel)

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

Total release size: 43.4 kB

Release files / aioxlsxstream-1.0.3.tar.gz

Download URL aioxlsxstream-1.0.3.tar.gz
Size 20.6 kB
Tags Source
SHA-256 checksum
How to use checksums
913fc3987a72739e233216c771a6efadecaddca86f18b59fd02230c09bef3e0f
BLAKE2b-256 checksum
How to use checksums
6754089741cc7a39f37f07ef4251667a89bf5d3edfd88a658978ee2d79381d81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.15 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.5

Release files / aioxlsxstream-1.0.3-py3-none-any.whl

Download URL aioxlsxstream-1.0.3-py3-none-any.whl
Size 22.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fd65ae92ebfb3d793b57f874fb6f5c6272e2bcbe11d5013280a56136acd7c1a9
BLAKE2b-256 checksum
How to use checksums
82ffc65b560b66ca77e59dd42ecaa327f6f8e34c454976d01f656ba8fe301d17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.15 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.5

Security for aioxlsxstream 1.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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