Skip to main content

sheetpeek

sheetpeek shows an Excel workbook the way Excel shows it: as HTML, Markdown, terminal output or plain text. It is pure Python, needs no office suite, and gives programs access to the rendered cells. Number formats are applied by xlformat, whose output is tested against text captured from Excel for Mac and Excel for Windows.

Documentation: https://sheetpeek.readthedocs.io.

Reading a sheet

read returns a Sheet: the values Excel shows on opening, number formats, styles, column widths, row heights and merged ranges of one worksheet. Dates stay the serial numbers Excel stores.

>>> import tempfile, pathlib, openpyxl, sheetpeek
>>> path = pathlib.Path(tempfile.mkdtemp()) / "example.xlsx"
>>> wb = openpyxl.Workbook()
>>> wb.active["A1"] = 1234.5
>>> wb.active["A1"].number_format = "#,##0.00"
>>> wb.active.merge_cells("B1:C1")
>>> wb.save(path)
>>> sheet = sheetpeek.read(path)
>>> cell = sheet.cell(1, 1)
>>> cell.value, cell.kind, cell.number_format
(1234.5, 'number', '#,##0.00')
>>> [str(m) for m in sheet.merges]
['B1:C1']

Showing a sheet

sheetpeek.render draws a sheet with a backend. Each shows what Excel shows, as far as its format can: number formats, # for a number too wide for its column, text spilling into empty neighbors.

>>> path = pathlib.Path(tempfile.mkdtemp()) / "sales.xlsx"
>>> wb = openpyxl.Workbook()
>>> ws = wb.active
>>> ws.append(["Region", "Sales", "Change"])
>>> ws.append(["North", 1234.5, 0.125])
>>> ws.append(["South", -98765.4, -0.0425])
>>> ws.append(["A note long enough to spill"])
>>> for row in (2, 3):
...     ws.cell(row, 2).number_format = "#,##0.00;[Red]-#,##0.00"
...     ws.cell(row, 3).number_format = "0.0%"
>>> wb.save(path)
>>> sales = sheetpeek.read(path)
>>> print(sheetpeek.render(sales, "text"), end="")
Region   Sales    Change
North    1,234.50    12.5%
South    ########    -4.3%
A note long enough to spill
>>> print(sheetpeek.render(sales, "markdown"), end="")
| Region | Sales | Change |
| --- | ---: | ---: |
| North | 1,234.50 | 12.5% |
| South | -98,765.40 | -4.3% |
| A note long enough to spill |  |  |
>>> print(sheetpeek.render(sales, "csv"), end="")
Region,Sales,Change
North,"1,234.50",12.5%
South,"-98,765.40",-4.3%
A note long enough to spill,,
>>> page = sheetpeek.render(sales, "html")  # a static page in Excel's own geometry
>>> page.startswith("<!doctype html>")
True

Fixed-width text gives every column its width in characters; Markdown and CSV have no widths, so they show every value in full. HTML is drawn in points from Excel's layout: column widths, row heights, each text's position and clip window, the # runs in the section's color (the negative is red), and fills. sheetpeek.render(sales, "rich"), or rich.print(sales), draws the fixed-width layout in a terminal with fonts, colors and fills (the optional rich extra).

From the command line:

sheetpeek view sales.xlsx                 # rich on a terminal, plain text when piped
sheetpeek view sales.xlsx -t html > sales.html
sheetpeek serve reports/                  # every workbook under reports/ as HTML pages

Sheet.layout gives the layout itself, the data every backend draws from: in excel mode each column's position and width and each text's position in points, in characters mode the characters each column draws. The documentation's usage page has examples.

Workbooks are read with xlio, in one pass over each sheet's cells, with values as Excel reads them. A formula shows what Excel shows when it opens the file: the cached value, or where Excel recalculates (a file another program wrote, for one), the value xlrecalc computes; recalc_on_load="never" keeps the cached values. ref="A1:H40" keeps part of a sheet (the whole sheet is still read, for its used range), and sheetpeek.open reads several sheets with one load. The defaults follow Excel for Windows at 96 dpi: column widths, number formats, text and its insets, rows, baselines and underlines in whole pixels, superscript and subscript rows included, and en-US regional settings. platform="mac" shows a workbook as Excel for Mac does instead. Rows at font sizes above 72 points are unverified.

A file from someone you do not trust is checked before anything parses it, and limits= sets what a read may cost; the documentation's usage page has the details. sheetpeek serve has no authentication: with --host, anyone who can reach the address can read the folder. It is not for production: it is built on Python's http.server, which Python's documentation does not recommend for production. For a production service, call the Python API from a web framework and pass limits=, since the library's defaults are not memory-safe for untrusted files.

Installation

pip install sheetpeek
pip install "sheetpeek[rich]"   # with styled terminal output

Python 3.11 or later. Depends on xlio, xlformat and xlrecalc. The examples here build their workbooks with openpyxl (pip install openpyxl), which sheetpeek itself does not need.

Security

To report a security problem, see SECURITY.md.

sheetpeek is part of the sheetmill project, with xlio, which reads and writes the workbooks, xlformat, which applies Excel number formats, and xlrecalc, a formula engine.

Development

uv sync --group docs then uv run pytest; CONTRIBUTING.md has the pip route, the full set of checks and the commit conventions. ARCHITECTURE.md describes the design and the measurements behind it.

Most of the code is written with Claude Code, reviewed before each commit and tested against output captured from Excel; see CONTRIBUTING.md.

License

MIT.

Metadata

Release files for sheetpeek 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sheetpeek 0.7.0
File Size Uploaded Provenance Actions
sheetpeek-0.7.0.tar.gz 1.1 MB With provenance Details for sheetpeek-0.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sheetpeek 0.7.0
File Interpreter ABI Platform Actions
sheetpeek-0.7.0-py3-none-any.whl Python 3 none any Details for sheetpeek-0.7.0-py3-none-any.whl

Total release size: 1.3 MB

Release files / sheetpeek-0.7.0.tar.gz

Download URL sheetpeek-0.7.0.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
b25b45d1c9918da61cdc7f6f9c0384d584e17d6bc0d5cac2b8fded242c14a788
BLAKE2b-256 checksum
How to use checksums
9a08d22fd38a54e6752fe17d0406c1e7c74809409ed6335b5dd40c2370943571
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / sheetpeek-0.7.0-py3-none-any.whl

Download URL sheetpeek-0.7.0-py3-none-any.whl
Size 223.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
327163dd92cf52267a49de8cce91733577d26d82c597ccd81a9fde88b6819562
BLAKE2b-256 checksum
How to use checksums
ebf2fe616d34d3957915342e742a4e8653aa15ac7778f576217ad55082cbc0ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for sheetpeek 0.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sheetpeek-0.7.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page