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-5/

In-Memory Excel Gateway

A utility that builds, reads, and updates Excel workbooks entirely in memory, avoiding any filesystem writes.

Capabilities

Round-trips workbook bytes

  • Given sheet data for "Summary" ([["Total", 3], ["Checked", True]]) and "Data" ([[1, "a"], [2, "b"]]), generating workbook bytes and immediately reloading them in memory keeps sheet order and cell values identical without writing to disk. @test

Accepts raw upload content

  • Loading workbook content provided as raw bytes (e.g., file uploads) returns the same cell grid as a stream-based read without touching disk for a sheet [["id", "score"], [101, 88.5]]. @test

Appends rows in memory

  • Providing existing workbook bytes for a "Logs" sheet ([["event", "status"], ["init", "ok"]]) and a new log row ["sync", "done"] returns updated bytes that, when reloaded, include the appended row after existing rows. @test

Treats bytes and BytesIO equally

  • Parsing the same workbook from bytes and from a BytesIO stream yields matching sheet dictionaries for identical content, with no filesystem writes. @test

Implementation

@generates

API

from typing import Any, BinaryIO, Mapping, MutableMapping, Sequence

def create_workbook_bytes(sheets: Mapping[str, Sequence[Sequence[Any]]]) -> bytes:
    """
    Build an Excel workbook from an ordered mapping of sheet names to row data
    using only in-memory buffers.
    """


def load_workbook(workbook_input: bytes | BinaryIO) -> MutableMapping[str, list[list[Any]]]:
    """
    Read workbook content from bytes or a binary stream and return sheet data
    with rows preserved in order.
    """


def append_row(workbook_input: bytes | BinaryIO, sheet_name: str, row: Sequence[Any]) -> bytes:
    """
    Append a row to the given sheet (creating it when missing) using only in-memory
    buffers and return updated workbook bytes.
    """

Dependencies { .dependencies }

pyexcel-xlsx { .dependency }

Enables reading and writing Excel workbooks from bytes, streams, and raw content without disk I/O.

Install with Tessl CLI

npx tessl i tessl/pypi-pyexcel-xlsx

tile.json