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

Visible Excel Extractor

Build a small utility that reads an Excel worksheet and returns only the visible cell values, omitting any hidden rows and columns. Output order must match the order of visible rows and columns in the sheet.

Capabilities

Visible grid extraction

  • Loading a sheet where column A is hidden, row 2 is hidden, and row 3 is visible should return [["Name", "Score"], ["Bob", 88]] when the visible cells contain a header row ["Name", "Score"] and a visible data row ["Bob", 88]; the hidden ID column and the hidden second row are not included. @test

Hidden column removal

  • For a sheet whose middle column is hidden (e.g., headers ["Item", "Code", "Qty"] with column B hidden), the returned grid must exclude the hidden column entirely while keeping row order, producing [["Item", "Qty"], ["Pencil", 12], ["Book", 5]] for the corresponding visible cells. @test

In-memory input

  • When provided with an in-memory Excel file object containing hidden rows and columns like the first scenario, the returned grid should match [["Name", "Score"], ["Bob", 88]], confirming hidden content is skipped even when reading from bytes. @test

Implementation

@generates

API

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

def extract_visible_cells(source: Union[str, BinaryIO], sheet_name: Optional[str] = None) -> List[List[Any]]:
    """
    Read a worksheet and return a matrix of visible cell values only, omitting hidden rows and columns.
    - source: path to the workbook or a binary file-like object positioned at the start.
    - sheet_name: optional sheet to read; defaults to the first sheet when not provided.
    """

Dependencies { .dependencies }

pyexcel-xlsx { .dependency }

Skip-aware Excel reader for loading visible worksheet content.

Install with Tessl CLI

npx tessl i tessl/pypi-pyexcel-xlsx

tile.json