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.19.0.tar.gz (60.3 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.19.0-cp314-cp314t-win_amd64.whl (2.9 MB view details)

Uploaded CPython 3.14tWindows x86-64

fastexcel-0.19.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.19.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.19.0-cp314-cp314t-macosx_11_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.14tmacOS 11.0+ ARM64

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

Uploaded CPython 3.14tmacOS 10.12+ x86-64

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

Uploaded CPython 3.10+Windows x86-64

fastexcel-0.19.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.19.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.19.0-cp310-abi3-macosx_11_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

fastexcel-0.19.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.19.0.tar.gz.

File metadata

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

File hashes

Hashes for fastexcel-0.19.0.tar.gz
Algorithm Hash digest
SHA256 216c3719ee90963bd93a0bf8c10b177233046ac975b67651152fdaedd3c99aa1
MD5 1c9e9d2d611b7f7daad9a4ffed0fd688
BLAKE2b-256 0dc83b09911348e9c64dbf41096d3e8f0e93c141a23990ec9f32514111bd5f55

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastexcel-0.19.0-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 7ef8e41cb0118f90d5f9a636fcdc0e9d635938cdaa54a3182328f3d34ce9ee1a
MD5 4f3658aee90d3c3c7ee764607f21eef2
BLAKE2b-256 4838b3faa12a74f387e037ff33adae761c22fc3aa44eed15a2c09d653b4eb194

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastexcel-0.19.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 75aad96c34836eca90fc6d0e061240c145795f8754424698e2aadfd634abb4cf
MD5 390a7d6868dad7d565d1df1362476be4
BLAKE2b-256 76500e5c416b990d153bad1e63b8268ea751fc8a319d134de14e3bbba38000c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastexcel-0.19.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e3c49fac330cc306bb0bd73d96138f438441d8254eed19ca6c1800aaa9d69054
MD5 004df1521fb004b54437fbe39aa33cc2
BLAKE2b-256 851b57a5e2441ab29ecb774f642f66d5e9f9246cdc14ca4ee85ada5b081f4656

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastexcel-0.19.0-cp314-cp314t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 42d48b077b7ec070de6ea34c99f9a0c97e45cd767fbadd135fc30fa70de24b42
MD5 0271cefab0664008a489c8b8ca9095cb
BLAKE2b-256 fb1e1364b08c1d5449236af23366ac3beaabbc63b283f354fc1aa6ad0b95cc37

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastexcel-0.19.0-cp314-cp314t-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 26eb85d98087b3c13e083a1fb51a3dfcd57607865fb44d8d6db451948ef65c63
MD5 ba80d8b282a6b357fddc0501f38867e7
BLAKE2b-256 aaa44290e356cfe028b11db8d96f8d5bca43bde8ed1fd9a491661df4d57551de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastexcel-0.19.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 fbbdf9de79c3ef3572809bb187927c0dc5840968ffe513ea015a383024b7c6b0
MD5 11f83190f9f504cbb9a21b09984188ed
BLAKE2b-256 6e675f6d4e7760dc3dd8244cd124dabdd5bb7622bf1197edcc2513648847690e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastexcel-0.19.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 334f9f40cd68b5924a712b6c104949757a0b8ad8a7e3fa3f3fad1c1ebc00258b
MD5 fb09004150d5cac9a7b4a141b55171e2
BLAKE2b-256 58aed2ffdc5ad14190153e2422fc90a1052a4b0c3086d24cb8ae8967575321d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastexcel-0.19.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e94fc1be6642555f277af792c22a9f80ec9b4d640d9690f00abb822b6d865069
MD5 931b18ad06854b6e74fae46cb445333c
BLAKE2b-256 8e4abc358b20fcff64b4c14ff7d7a0e1f797792b8b77e30ae755873c02362538

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastexcel-0.19.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c8a87d94445678e7e3f46a6aa39d2afaee5b88a983ec3661143a6488d8955f44
MD5 ae9145f698df149758e8f572f775ac07
BLAKE2b-256 660fb42dc09515879192919942157292912393584045fd8bad98bd92961d4c30

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastexcel-0.19.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 68601072a0b4b4277c165b68f1055f88ef7ffe7ed6f08c1eeda0f0271e3f7da0
MD5 d734b53efb0d0cacb30ebf8e12f84c18
BLAKE2b-256 d1e03820e93ea606549cfddb8c437141dd69f2b245e74785efc8bd7511ba909d

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