Skip to main content

CrabXL

Read, write, edit and stream Excel .xlsx files in Python, with a Rust core.

PyPI Python CI License

CrabXL is a spreadsheet library for Excel workbooks. The Rust core parses and writes the files, so it is fast and uses little memory. The Python API is fully typed and checked with mypy, pyright and pyrefly in strict mode.

  • Workbook creates a workbook, or opens one to change and save it. Reader and Writer stream rows of files of any size in bounded memory.
  • Saves are lossless: they copy every part you did not change, and they raise an error instead of dropping content. Saves to a path are atomic.
  • Inserting or deleting rows or columns updates every reference to the moved cells.
  • Numbers keep their precision, and text never turns into a formula.
  • Styles, number formats, formulas, merged cells, tables, data validation, conditional formats, pictures and charts.
  • Have openpyxl code? crabxl.openpyxl runs it unchanged. See openpyxl code.

Before version 1.0, a minor version can change the API.

Installation

pip install crabxl

Or with uv:

uv add crabxl

CrabXL needs CPython 3.13 or newer. Its native module comes from the crabxl-bindings package, with wheels for Linux x86_64/ARM64, Windows x86_64, and macOS Intel/Apple Silicon.

Usage

Create a workbook

import crabxl as xl

header = xl.Style(font=xl.Font(bold=True), fill=xl.Fill("DDEBF7"))

with xl.Workbook() as book:
    sheet = book.worksheets.add("Sales")
    sheet.append(["Region", "Q1", "Q2", "Total"], style=header)
    sheet.append(["North", 120.5, 98, xl.Formula("B2+C2")])
    sheet.columns("A:D").width = 14
    sheet.freeze_panes = "A2"
    book.save("sales.xlsx")

Edit a file

with xl.Workbook.open("sales.xlsx") as book:
    sheet = book.worksheets["Sales"]
    sheet.rows("2").insert()  # The formula now reads =B3+C3.
    sheet["A2:C2"].values = [["South", 80, 95]]
    sheet["B2:C3"].map_style(lambda s: s.replace(number_format="#,##0.00"))
    book.save("sales.xlsx")  # Atomic, even over the source.

Stream rows

with xl.Reader.open("events.xlsx") as reader:
    for row in reader.worksheets["Events"].iter_rows(columns="A:C", skip=1):
        event_id, kind, amount = row

with xl.Writer.create("export.xlsx") as writer:
    sheet = writer.worksheets.add("Events")
    sheet.extend((n, "sale", n * 1.5) for n in range(1_000_000))

openpyxl code

The openpyxl interface is the crabxl-openpyxl package. Install it with CrabXL:

pip install "crabxl[openpyxl]"
import crabxl.openpyxl as openpyxl

book = openpyxl.load_workbook("input.xlsx")
book.active["A1"] = "Updated"
book.save("output.xlsx")

crabxl.openpyxl is the module crabxl_openpyxl. On Python 3.9 to 3.12, install crabxl-openpyxl alone and import crabxl_openpyxl.

Documentation

License

MIT. Source code, issues and contributions: crabxl/crabxl-python.

Metadata

Release files for crabxl 0.6.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 crabxl 0.6.0
File Size Uploaded Provenance Actions
crabxl-0.6.0.tar.gz 26.1 kB With provenance Details for crabxl-0.6.0.tar.gz

Built distribution (wheel)

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

Total release size: 56.7 kB

Release files / crabxl-0.6.0.tar.gz

Download URL crabxl-0.6.0.tar.gz
Size 26.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f6b0667e9c7a3e8ae736a8aa334b8ae07614b01873985f136e604aaf2e66ea7c
BLAKE2b-256 checksum
How to use checksums
e5507f966cb0774e3787b88738922fcffad560341ace44e04d57d317c90bfe41
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 / crabxl-0.6.0-py3-none-any.whl

Download URL crabxl-0.6.0-py3-none-any.whl
Size 30.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e8b3f6c4ed27bda05e795ccc950b0abce759ae52bcc7873b2a662587afcbaa41
BLAKE2b-256 checksum
How to use checksums
a0e32ebd5fc4ff469d369a626da8c5644b21bbbc97758a456e3b304d980dfc2e
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 crabxl 0.6.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 crabxl-0.6.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