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

Workbook Order Snapshot

Load an Excel workbook and return sheet snapshots in workbook order while preserving native datetime and time values.

Capabilities

Maintains workbook ordering

  • Given a workbook with sheets named "Summary", "Data", and "Empty" in that order, reading returns three SheetSnapshot entries with matching names in the same order; "Data" rows equal [["item", "count"], ["apples", 3]] and "Empty" rows are an empty list rather than being dropped. @test

Preserves datetime and time objects

  • For a workbook containing a datetime value 2024-05-06 14:30:00 and a time value 09:15:30, returned rows keep those cells as datetime.datetime and datetime.time instances with the same values (not strings or numbers). @test

Works with in-memory bytes

  • When provided the workbook as raw XLSX bytes through a binary stream, the reader returns the same ordered sheet snapshots and native datetime/time types as reading from a file path. @test

Implementation

@generates

API

from dataclasses import dataclass
from datetime import datetime, time
from typing import BinaryIO, List, Sequence, Union

@dataclass
class SheetSnapshot:
    name: str
    rows: List[Sequence[object]]

def read_workbook(source: Union[str, BinaryIO, bytes]) -> List[SheetSnapshot]:
    """
    Read an XLSX/XLSM workbook from a filesystem path, bytes buffer, or open binary stream.
    Preserves workbook sheet order and keeps datetime/time values as native Python objects.
    Empty sheets are included with an empty rows list.
    """

Dependencies { .dependencies }

pyexcel-xlsx { .dependency }

Provides Excel read/write support that preserves workbook sheet ordering and native datetime/time types when loading data.

Install with Tessl CLI

npx tessl i tessl/pypi-pyexcel-xlsx

tile.json