
fastexcel
High-Performance Excel Reader for Python & Rust
Zero-Copy Arrow Integration, Polars & Pandas Support, Memory-Efficient XLSX/XLS Parsing via Rust & Apache Arrow.
What is fastexcel?
fastexcel is a high-performance Excel file reader built in Rust and exposed to Python, leveraging Apache Arrow for zero-copy data exchange. It supports modern Python libraries like Polars and Pandas while minimizing memory overhead and maximizing throughput. Designed for production use, fastexcel uses the Arrow PyCapsule Interface to enable seamless integration with any Arrow-compatible system—without requiring PyArrow as a dependency. Its core engine relies on the battle-tested calamine Rust crate for robust parsing of XLS, XLSX, and XLSM formats, making it ideal for large-scale data ingestion pipelines.
The library emphasizes flexibility, performance, and developer experience: it offers optional dependencies (e.g., `polars`, `pandas`, `pyarrow`) so users can install only what they need. With lazy loading, type inference, and support for Excel tables, fastexcel delivers both speed and control. It is production-ready for Python (v1.0.0 milestone in progress), while the Rust crate remains experimental. Whether you're processing thousands of sheets or building low-latency analytics, fastexcel bridges the gap between raw speed and ergonomic APIs—making it the go-to choice for modern spreadsheet processing in Python and Rust.
Getting Started with fastexcel
Install fastexcel via pip with optional dependencies tailored to your workflow. For lightweight usage, run `pip install fastexcel` (no PyArrow). To integrate with Polars, use `pip install fastexcel[polars]`; for Pandas, use `pip install fastexcel[pandas]`. The library is available on [GitHub](https://github.com/ToucanToco/fastexcel) and supports Python 3.8+. After installation, import `fastexcel`, read an Excel file using `read_excel()`, and load sheets or tables for zero-copy or Pandas/Polars conversion.
Install fastexcel via PIP
# Minimal install (no PyArrow)
pip install fastexcel
# With Polars support (zero-copy, no PyArrow)
pip install fastexcel[polars]
# With Pandas support (includes PyArrow)
pip install fastexcel[pandas]
Zero-Copy Arrow Integration
fastexcel leverages the Arrow PyCapsule Interface for zero-copy data exchange with Polars and other Arrow-compatible libraries—no PyArrow dependency required. This eliminates unnecessary memory copies and significantly improves performance, especially for large datasets. By exposing sheets as Arrow-compatible objects, fastexcel enables direct construction of Polars DataFrames via `pl.DataFrame(sheet)` or `sheet.to_polars()`. Developers can also access raw Arrow schema and array data through `__arrow_c_schema__()` and `__arrow_c_array__()`, giving full control over data movement. This approach aligns with modern data engineering best practices, reducing latency and memory pressure in ETL pipelines and analytics workloads.
Zero-Copy Polars Integration via PyCapsule
import fastexcel
import polars as pl
reader = fastexcel.read_excel("data.xlsx")
sheet = reader.load_sheet(0)
# Direct zero-copy DataFrame creation
df = pl.DataFrame(sheet)
print(df)
# Alternative via method
df = sheet.to_polars()
Flexible Dependency Management
fastexcel offers modular dependency installation, allowing developers to include only the integrations they need. The core package is lightweight and dependency-free, while extras like `[polars]`, `[pandas]`, `[pyarrow]`, or `[pandas,polars]` enable specific workflows. This design reduces installation size and avoids version conflicts—critical for production environments and containerized deployments. For instance, users working exclusively with Polars can install `fastexcel[polars]` and avoid pulling in PyArrow entirely. Meanwhile, those relying on Pandas benefit from seamless `to_pandas()` conversion. This flexibility ensures optimal resource usage and simplifies dependency management across development, testing, and production stages.
Install with Specific Integrations
# Minimal (no external deps)
pip install fastexcel
# Polars-only (zero-copy, no PyArrow)
pip install fastexcel[polars]
# Full stack (Pandas + Polars + PyArrow)
pip install fastexcel[pandas,polars]
Excel Table Support
fastexcel natively supports Excel tables—structured ranges with headers and metadata—enabling more robust data access than raw sheet parsing. Use `reader.table_names()` to list available tables, then load a specific table via `reader.load_table("TableName")`. Tables preserve column names, data types, and relationships, reducing the need for manual preprocessing. This is especially valuable when working with business-critical spreadsheets where table semantics matter. Combined with zero-copy Arrow integration, loading tables into Polars or Pandas becomes both accurate and efficient. Whether you're ingesting financial models, dashboards, or legacy reports, table support ensures fidelity and consistency in downstream analytics.
Load Excel Tables Directly
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("SalesData")
df = pl.DataFrame(table) # Zero-copy via PyCapsule
High-Performance Parsing Engine
Built on Rust using the calamine library and Apache Arrow, fastexcel delivers exceptional speed and memory efficiency for Excel parsing. Its lazy loading mechanism avoids reading entire files into memory, while optional eager evaluation gives developers control over trade-offs between latency and throughput. Automatic type inference handles mixed content intelligently, with manual override options for edge cases. Benchmarks consistently show fastexcel outperforming traditional Python-based readers like `openpyxl` and `xlrd`, especially for large files (>100k rows). This makes it ideal for real-time analytics, batch processing, and resource-constrained environments. With `make benchmarks` and memory profiling tools included in the dev workflow, the project maintains rigorous performance standards.
Load Sheet with Lazy Evaluation
import fastexcel
reader = fastexcel.read_excel("large_data.xlsx")
# Lazy: sheet not loaded until accessed
sheet = reader.load_sheet(0)
# Eager: force full load (optional)
# sheet = reader.load_sheet(0, eager=True)
# Process data efficiently
df = sheet.to_polars() # Zero-copy if Polars
