CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-pyexcel-xlsx

A wrapper library to read, manipulate and write data in xlsx and xlsm format

76

1.38x
Overview
Eval results
Files

task.mdevals/scenario-10/

Write-only Excel Exporter

Create a helper that converts a mapping of sheet names to row data into an XLSX workbook using streaming write-only writes so large datasets can be exported without holding full workbook state in memory.

Capabilities

Save to file path

  • Writing two sheets with mixed numeric/text rows to a file path produces a workbook whose sheets, row order, and cell values match the input when reloaded. @test

Save to bytes buffer

  • Writing the same sheet mapping to an in-memory binary stream returns bytes that reload into identical sheet names and rows. @test

Preserve empty sheets

  • An input that includes an empty sheet list writes a workbook where that sheet exists and is empty on reload, while non-empty sheets retain row order. @test

Stream large rows

  • Exporting a sheet with thousands of rows completes via streaming write-only output and reloads with only the provided rows present. @test

Implementation

@generates

API

from typing import Any, BinaryIO, Dict, Iterable, Optional, Sequence, Union


def write_workbook(sheets: Dict[str, Iterable[Sequence[Any]]], target: Union[str, BinaryIO]) -> Optional[bytes]:
    """
    Writes the provided sheets to an XLSX workbook using streaming write-only output.

    When a file path is provided, writes to disk and returns None.
    When a binary stream is provided, writes to the stream and returns the written bytes.
    """

Dependencies { .dependencies }

pyexcel-xlsx { .dependency }

Provides XLSX streaming read/write support.

Install with Tessl CLI

npx tessl i tessl/pypi-pyexcel-xlsx

tile.json