Skip to main content

High-performance Python library for streaming Excel (XLSX) data to Apache Arrow format

Project description

xsxl - High-Performance Excel to Arrow Parser

A blazingly fast Python library for streaming Excel (XLSX) data directly to Apache Arrow format, built in Rust with PyO3.

Features

  • Streaming Architecture: Process files larger than memory with configurable batch sizes
  • Lazy Loading: Only loads metadata on open, data parsed on-demand
  • Type Inference: Automatically infers Arrow types from Excel number formats
  • High Performance: ~3M cells/sec with full type inference
  • Zero-Copy: Uses Arrow C Data Interface for efficient data transfer
  • Thread-Safe: GIL released during parsing for true parallelism

Installation

pip install xsxl

Quick Start

import xsxl

# Open workbook (metadata only, no data loaded)
wb = xsxl.open("data.xlsx")

# Iterate over sheets
for sheet_name in wb:
    print(f"Found sheet: {sheet_name}")

# Get a specific sheet (still no data loaded)
sheet = wb["Sales"]

# Reference a range (still lazy)
range = sheet.get_range("A1:Z10000")

# Now data is parsed and streamed
for batch in range.iter_batches(batch_size=5000):
    print(f"Got {batch.num_rows} rows")

# Or convert to pandas/polars
df = range.to_pandas()
pl_df = range.to_polars()

Usage Examples

Stream Large Files

wb = xsxl.open("huge_file.xlsx")
range = wb["Sheet1"].get_range("A1:ZZ1000000")

# Process in batches to keep memory bounded
for batch in range.iter_batches(batch_size=10000):
    # Process each batch
    process_batch(batch.to_pandas())

Load Multiple Sheets Selectively

wb = xsxl.open("multi_sheet.xlsx")

# Load only sheets matching pattern
data = {}
for name in wb:
    if name.startswith("Sales_"):
        data[name] = wb[name].get_range("A1:Z1000").to_pandas()

Transpose Mode

# For data laid out horizontally
range = sheet.get_range("A1:J100", transpose=True)
df = range.to_pandas()  # Columns become rows

Performance

Benchmarked on 2024 MacBook Pro M4:

  • Parsing: 2,989,014 cells/sec with full type inference
  • Memory: <100MB for metadata, configurable batch sizes for data
  • GIL: Released during parsing for true parallelism

License

MIT OR Apache-2.0

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

xsxl-0.1.0-cp39-abi3-win_amd64.whl (630.1 kB view details)

Uploaded CPython 3.9+Windows x86-64

xsxl-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (757.6 kB view details)

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

xsxl-0.1.0-cp39-abi3-macosx_11_0_arm64.whl (699.3 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file xsxl-0.1.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: xsxl-0.1.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 630.1 kB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.9.6

File hashes

Hashes for xsxl-0.1.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 44db7f0307baa2c1d71a4c84f3086beb92e64f4d86d01445bd7e4088d141803f
MD5 116e23b509752f2ab3ae7fd04ac69fbc
BLAKE2b-256 dbee622158a35dcfdd2d5324bc7100cd9f63f46ed7a4c4f50d2d21dceafe9f0f

See more details on using hashes here.

File details

Details for the file xsxl-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for xsxl-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 638534aabc02d561cba9ee81ece5dd6b4b19793b616435e3210ded7c5a3df36e
MD5 6b7eea3c9a4c4aa87907225a512e2ed2
BLAKE2b-256 7cf0980e906756270580d68977c84c5f229dec2c2ede796922daf086d57c597d

See more details on using hashes here.

File details

Details for the file xsxl-0.1.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for xsxl-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 33a5aff287d3ea77d011788d84e8dfb7c71f7b0d41738e029120382166d0e59d
MD5 e63e810e902cd3f31a427090a16b8095
BLAKE2b-256 a55506207c04b0d1ad5b66f6acd2cc1b73d7b84eaa604177e7274f541795f42e

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