Skip to main content

Headless Spreadsheets

Spreadsheet-native tables for ordinary Python applications. Pure Python 3.14+, zero runtime dependencies, MIT licensed.

Keep typed values, formula text and cached results together, work with named records, and move data between Python, CSV, native JSON and table displays.

pip install headless-spreadsheets

A table without a workbook

from headless_spreadsheets import Table

sales = Table.from_records([
    {"item": "Book", "price": 12, "quantity": 3},
    {"item": "Pen", "price": 2, "quantity": 10},
    {"item": "Bag", "price": 25, "quantity": 2},
])
sales.add_column("total", lambda row: row["price"] * row["quantity"])

report = sales.where(total__gte=30).sort_by("total", reverse=True)
print(report.select("item", "total").to_markdown())
| item | total |
| :--- | ---: |
| Bag | 50 |
| Book | 36 |

Rows behave like read-only dictionaries; columns behave like read-only sequences. Filtering, sorting and selection return views with fixed source membership and live values. They keep the original cells in place.

Preserve spreadsheet expressions

sales.set_formula("D2", "=B2*C2", cached_value=36)
cell = sales.cell("D2")
assert cell.formula == "=B2*C2"
assert cell.value == 36
assert cell.cache_status == "stale"

restored = Table.from_json(sales.to_json())
assert restored.cell("D2") == cell

Table addresses include a header at row 1; data begins at row 2. Sheet is a rectangular grid without an implicit header, and Workbook contains named sheets. Literal strings starting with = remain text unless explicitly supplied as formulas.

v0.1 preserves formulas and supplied cached results; it does not calculate them. Formula caches are always stale or missing. Unknown formulas stay inspectable and exportable. Views expose source_address() and retain original formula text; view.to_table() deliberately creates an independent values-only copy. Number-format hints are stored without being applied.

Interchange and display

sales.to_json("sales.json")             # Types, formulas, cache and hints
sales = Table.read_json("sales.json")
sales.to_csv("sales.csv")               # Values; active text escaped by default
text_table = Table.read_csv("sales.csv") # All imported fields are text
sales.to_csv("sales.tsv", delimiter="\t")

sales.to_markdown("sales.md")
sales.to_html("sales.html")
print(sales.to_ansi(max_width=24, color=True))
print(sales.render("markdown", formulas=True))

Each export returns text and optionally writes a UTF-8 file atomically. Text readers are from_csv(text) and from_json(text); path readers are read_csv and read_json. CSV loses Python types and blank-versus-empty distinctions. Explicit CSV formula modes are available. Native JSON is the fidelity format. HTML/Markdown escape content; terminal output neutralizes input controls.

Scope

Supported cell values are blank (None), Boolean, integer, finite float, text, Decimal, date and datetime. Configurable Limits bound rows, columns, cells, sheets and serialized input. The core has no custom C/Rust extensions and requires no third-party packages. It makes no pandas-scale performance claim.

Formula calculation, F expressions, XLSX, Google Sheets, Markdown/HTML import, grouping/joins, async execution and undo/history are later milestones. The native table writer has no Pretty Notebook dependency; shared typed Markdown extraction is tracked separately.

Development

uv sync --locked
uv run --frozen python -W error::ResourceWarning -m unittest discover -s tests -v
uv run --frozen python examples/sales.py
uv run --frozen python scripts/check_distribution.py

CI tests Python 3.14 on Linux, macOS and Windows. Distribution verification checks exact archive contents, metadata, source bytes, source rebuild parity and the complete suite in independent wheel/source installations. See release procedures for the tag-driven Trusted Publishing workflow.

Metadata

Release files for headless-spreadsheets 0.1.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 headless-spreadsheets 0.1.0
File Size Uploaded Provenance
headless_spreadsheets-0.1.0.tar.gz 15.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for headless-spreadsheets 0.1.0
File Interpreter ABI Platform
headless_spreadsheets-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 36.2 kB

Release files / headless_spreadsheets-0.1.0.tar.gz

Download URL headless_spreadsheets-0.1.0.tar.gz
Size 15.8 kB
Tags Source
SHA-256 checksum
How to use checksums
45659599bc1fd76265b205e2578f5069012c2f2d8153b406dc49b49d10706f00
BLAKE2b-256 checksum
How to use checksums
27f161c399702ae431d88bd4f1ef53622404d0a14ea3ccc47fe9b6891d5d51e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 19, 2026.

Transparency log

Release files / headless_spreadsheets-0.1.0-py3-none-any.whl

Download URL headless_spreadsheets-0.1.0-py3-none-any.whl
Size 20.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e3168cf4db3c7d5ecfebedebcf988549a320d4b8d6beabac7b2d3ebdeac67230
BLAKE2b-256 checksum
How to use checksums
d32d758f79ea93650182fdafa62d6b41c6f6ba8c0ffd558a9e6955c36ff4ff3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 19, 2026.

Transparency log

Security for headless-spreadsheets 0.1.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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for headless_spreadsheets-0.1.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 Oct 19, 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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