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

Formula Round-Trip Keeper

A utility that round-trips Excel workbooks while preserving formula tokens and numeric formatting.

Capabilities

Workbook round-trip

  • Given workbook data containing a formula such as =SUM(B2:C2) alongside its referenced numeric cells, saving and reloading the workbook returns sheet data where the formula cell remains a formula string instead of a computed value. @test
  • Currency, percentage, and date-formatted numbers keep their Excel number formats (for example $#,##0.00, 0.00%, yyyy-mm-dd) after saving and reopening, and their underlying numeric values are unchanged. @test
  • The round-trip flow runs purely in memory using byte streams and yields the same sheet content as a disk-based run. @test

Implementation

@generates

API

from typing import Any, BinaryIO, Dict, List, Union

WorkbookData = Dict[str, List[List[Any]]]

def preserve_round_trip(source: Union[str, BinaryIO], target: Union[str, BinaryIO]) -> WorkbookData:
    """
    Read a workbook from source (file path or binary stream), write it back to target
    (file path or binary stream), and return reloaded sheet data with the same sheet
    ordering. Ensures formula strings and numeric formatting survive the round-trip,
    keeping empty sheets as empty row lists.
    """

Dependencies { .dependencies }

pyexcel-xlsx { .dependency }

Excel IO plugin used for reading and writing .xlsx/.xlsm files while preserving formulas and numeric formatting.

Install with Tessl CLI

npx tessl i tessl/pypi-pyexcel-xlsx

tile.json