Skip to main content

A fast excel file reader for Python, written in Rust

Project description

fastexcel

A fast excel file reader for Python and Rust.

Docs:

Stability

The Python library is considered production-ready. The API is mostly stable, and we avoid breaking changes as much as possible. v1.0.0 will be released once the milestone is reached.

⚠️ The free-threaded build is still considered experimental

The Rust crate is still experimental, and breaking changes are to be expected.

Installation

# Lightweight installation (no PyArrow dependency)
pip install fastexcel

# With Polars support only (no PyArrow needed)
pip install fastexcel[polars]

# With Pandas support (includes PyArrow)
pip install fastexcel[pandas]

# With PyArrow support
pip install fastexcel[pyarrow]

# With all integrations
pip install fastexcel[pandas,polars]

Quick Start

Modern usage (recommended)

FastExcel supports the Arrow PyCapsule Interface for zero-copy data exchange with libraries like Polars, without requiring pyarrow as a dependency. Use fastexcel with any Arrow-compatible library without requiring pyarrow.

import fastexcel

# Load an Excel file
reader = fastexcel.read_excel("data.xlsx")
sheet = reader.load_sheet(0)  # Load first sheet

# Use with Polars (zero-copy, no pyarrow needed)
import polars as pl
df = pl.DataFrame(sheet)  # Direct PyCapsule interface
print(df)

# Or use the to_polars() method (also via PyCapsule)
df = sheet.to_polars()
print(df)

# Or access the raw Arrow data via PyCapsule interface
schema = sheet.__arrow_c_schema__()
array_data = sheet.__arrow_c_array__()

Traditional usage (with pandas/pyarrow)

import fastexcel

reader = fastexcel.read_excel("data.xlsx")
sheet = reader.load_sheet(0)

# Convert to pandas (requires `pandas` extra)
df = sheet.to_pandas()

# Or get pyarrow RecordBatch directly
record_batch = sheet.to_arrow()

Working with tables

reader = fastexcel.read_excel("data.xlsx")

# List available tables
tables = reader.table_names()
print(f"Available tables: {tables}")

# Load a specific table
table = reader.load_table("MyTable")
df = pl.DataFrame(table)  # Zero-copy via PyCapsule, no pyarrow needed

Key Features

  • Zero-copy data exchange via Arrow PyCapsule Interface
  • Flexible dependencies - use with Polars (no PyArrow needed) or Pandas (includes PyArrow)
  • Seamless Polars integration - pl.DataFrame(sheet) and sheet.to_polars() work without PyArrow via PyCapsule interface
  • High performance - written in Rust with calamine and Apache Arrow
  • Memory efficient - lazy loading and optional eager evaluation
  • Type safety - automatic type inference with manual override options

Contributing & Development

Prerequisites

You'll need:

  1. Rust - Rust stable or nightly
  2. uv - Fast Python package manager (will install Python 3.10+ automatically)
  3. git - For version control
  4. make - For running development commands

Python Version Management: uv handles Python installation automatically. To use a specific Python version:

uv python install 3.13  # Install Python 3.13
uv python pin 3.13      # Pin project to Python 3.13

Quick Start

# Clone the repository (or from your fork)
git clone https://github.com/ToucanToco/fastexcel.git
cd fastexcel

# First-time setup: install dependencies, build debug version, and setup pre-commit hooks
make setup-dev

Verify your installation by running:

make

This runs a full development cycle: formatting, building, linting, and testing

Development Commands

Run make help to see all available commands, or use these common ones:

make all          # full dev cycle: format, build, lint, test
make install      # install with debug build (daily development)
make install-prod # install with release build (benchmarking)
make test         # to run the tests
make lint         # to run the linter
make format       # to format python and rust code
make doc-serve    # to serve the documentation locally

Useful Resources

Benchmarking

For benchmarking, use make benchmarks which automatically builds an optimised wheel. This is required for profiling, as dev mode builds are much slower.

Speed benchmarks

make benchmarks

Memory profiling

mprof run -T 0.01 python python/tests/benchmarks/memory.py python/tests/benchmarks/fixtures/plain_data.xls

Creating a release

  1. Create a PR containing a commit that only updates the version in Cargo.toml.
  2. Once it is approved, squash and merge it into main.
  3. Tag the squashed commit, and push it.
  4. The release GitHub action will take care of the rest.

Dev tips

  • Use cargo check to verify that your rust code compiles, no need to go through maturin every time
  • cargo clippy = 💖
  • Careful with arrow constructors, they tend to allocate a lot
  • mprof and time go a long way for perf checks, no need to go fancy right from the start

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastexcel-0.18.0.tar.gz (59.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

fastexcel-0.18.0-cp314-cp314t-win_amd64.whl (2.9 MB view details)

Uploaded CPython 3.14tWindows x86-64

fastexcel-0.18.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.17+ x86-64

fastexcel-0.18.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.2 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.17+ ARM64

fastexcel-0.18.0-cp314-cp314t-macosx_11_0_arm64.whl (2.8 MB view details)

Uploaded CPython 3.14tmacOS 11.0+ ARM64

fastexcel-0.18.0-cp314-cp314t-macosx_10_12_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.14tmacOS 10.12+ x86-64

fastexcel-0.18.0-cp310-abi3-win_amd64.whl (2.9 MB view details)

Uploaded CPython 3.10+Windows x86-64

fastexcel-0.18.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.4 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

fastexcel-0.18.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.2 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

fastexcel-0.18.0-cp310-abi3-macosx_11_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

fastexcel-0.18.0-cp310-abi3-macosx_10_12_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file fastexcel-0.18.0.tar.gz.

File metadata

  • Download URL: fastexcel-0.18.0.tar.gz
  • Upload date:
  • Size: 59.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.10.2

File hashes

Hashes for fastexcel-0.18.0.tar.gz
Algorithm Hash digest
SHA256 00d82b787ca6dd0fae9c5d75e6c7b0a2c489236ac93e63cba70571e6d3e87568
MD5 5b59bf32beea2d06dc28ccf4c2691139
BLAKE2b-256 8abd29c2e1689587ca5fa23f2e422e1a845cb6c3b6e19197f56d8ac8360f9889

See more details on using hashes here.

File details

Details for the file fastexcel-0.18.0-cp314-cp314t-win_amd64.whl.

File metadata

File hashes

Hashes for fastexcel-0.18.0-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 79bb347d1ea573f6ed7de01cec0a3fc850ddaade0096f9500a07692b32541af4
MD5 7588bbf348c3dfc8300ce83197d404f6
BLAKE2b-256 6fff7c1f5af4b3339910f11a9b621b72e1345b8016c6dff99737e9df1388e911

See more details on using hashes here.

File details

Details for the file fastexcel-0.18.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fastexcel-0.18.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 178cf27b44a8b16be23dc165081c144463322a91b6b4043e60d6cc1b9415233b
MD5 eb68eab7697864e99882b77a3827b72c
BLAKE2b-256 58a60957473ed388e8315d18c7c6e054b37b9f278b27a70afb50f6e3684528df

See more details on using hashes here.

File details

Details for the file fastexcel-0.18.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for fastexcel-0.18.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0cf22c4753c9895fe273835e160b52e64edaef89d84585a90f8b82ef1e9adc6a
MD5 0e52f3dd5f1bfa467203cca1a9bda287
BLAKE2b-256 c9c78fab170bf0fe48d0179e2bcbbdc797c8f577d7edbb7858fc23483cec2620

See more details on using hashes here.

File details

Details for the file fastexcel-0.18.0-cp314-cp314t-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fastexcel-0.18.0-cp314-cp314t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 102dfe32348519be7e8055f010f6fad1857201f768d94e418c563c6fde439410
MD5 2e353be36b05529e2f140a138b077f29
BLAKE2b-256 df1fe4e91eed5cc9ee7327176483204bf16611884315c11bca273f9e3fecf503

See more details on using hashes here.

File details

Details for the file fastexcel-0.18.0-cp314-cp314t-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for fastexcel-0.18.0-cp314-cp314t-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 cb9be21a5b5e28cd77081f37e0a972833c8fb8f1b646986b56f893313672df0a
MD5 2a35b6c02dc86ddd9897064d2016f3fd
BLAKE2b-256 26f730bfe0a608bb26606b76db3ce9493501f2d3d5b0efc29de75175b9b847ca

See more details on using hashes here.

File details

Details for the file fastexcel-0.18.0-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for fastexcel-0.18.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 259d29c1f40828e4665d64762232dd6680fec2344192ea850ba9fe4f4fddd6de
MD5 be0dad846827f8a7d33c0bc017b8cc26
BLAKE2b-256 d87161572e6c59029a1edfe99ec05722cb1fcdf4825adc49c5c9308fa7e83c24

See more details on using hashes here.

File details

Details for the file fastexcel-0.18.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fastexcel-0.18.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9eaebd921d4d89d02293e94739d92965f58873433e77a44a187ed1947769592c
MD5 0bb901648b6c407a8276b016686771f8
BLAKE2b-256 81c5d2833ce05892e78979450c0a439a0298bddbb5613244d5d43406341cc217

See more details on using hashes here.

File details

Details for the file fastexcel-0.18.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for fastexcel-0.18.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3f8edb3e38aa458a110dffd3fb6aabb64ef8e10b8c5cede2d2346e5c04e5e1ef
MD5 5c0fb022d6404e2a555521485850488a
BLAKE2b-256 1c0568f6145b7230a4e75b8c08a592ce4dcac88567420967aca190b7feee73e3

See more details on using hashes here.

File details

Details for the file fastexcel-0.18.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fastexcel-0.18.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b7fadce17c6649819709bd06f5acb66bae3ce38112237d80b4816ab791693b73
MD5 d73377936deb707974441c4d1a5c7e5b
BLAKE2b-256 8174ce74f5d5a7fd36e3384499fe43bb5db23cf16c98b7f95b0f3a2456361cb3

See more details on using hashes here.

File details

Details for the file fastexcel-0.18.0-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for fastexcel-0.18.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6ec6e53de42519b8a080dcaf1ec8e8eca99c5e6a19d30022d168f488b1f0ec12
MD5 8e3c20b4cfa53fc407779e36b025cbed
BLAKE2b-256 c9af86df57906c473d0072785360f1951b222ba6d33b2ff1e0bea86ff6070503

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page