Skip to main content

A fast, Rust-powered Excel xlsx library for Python with openpyxl-compatible API

Project description

rustypyxl

Quality Gate Status Maintainability Rating Security Rating Known Vulnerabilities

A Rust-powered Excel (XLSX) library for Python with an openpyxl-compatible API.

Installation

pip install rustypyxl

Usage

import rustypyxl

# Load a workbook
wb = rustypyxl.load_workbook('input.xlsx')
ws = wb.active

# Read values
value = wb.get_cell_value('Sheet1', 1, 1)

# Write values
wb.set_cell_value('Sheet1', 1, 1, 'Hello')
wb.set_cell_value('Sheet1', 2, 1, 42.5)
wb.set_cell_value('Sheet1', 3, 1, '=SUM(A1:A2)')

# Bulk operations
wb.write_rows('Sheet1', [
    ['Name', 'Age', 'Score'],
    ['Alice', 30, 95.5],
    ['Bob', 25, 87.3],
])

data = wb.read_rows('Sheet1', min_row=1, max_row=100)

# Save
wb.save('output.xlsx')

Features

  • openpyxl-compatible API: Familiar patterns for easy migration
  • Read and write support: Full round-trip capability
  • Cell values: Strings, numbers, booleans, dates, formulas
  • Formatting: Fonts, alignment, fills, borders, number formats
  • Workbook features: Comments, hyperlinks, named ranges, merged cells
  • Sheet features: Protection, data validation, column/row dimensions
  • Parquet import/export: Direct Parquet ↔ Excel conversion (bypasses Python FFI)
  • S3 support: Works with boto3 via bytes I/O
  • Bytes I/O: Load from bytes or file-like objects, save to bytes
  • Configurable compression: Trade off speed vs file size

Parquet Import

Import large Parquet files directly into Excel worksheets. Data flows from Parquet → Rust → Excel without crossing the Python FFI boundary, making it very fast for large datasets.

import rustypyxl

wb = rustypyxl.Workbook()
wb.create_sheet("Data")

# Import parquet file into sheet
result = wb.insert_from_parquet(
    sheet_name="Data",
    path="large_dataset.parquet",
    start_row=1,
    start_col=1,
    include_headers=True,
    column_renames={"old_name": "new_name"},  # optional
    columns=["col1", "col2", "col3"],  # optional: select specific columns
)

print(f"Imported {result['rows_imported']} rows")
print(f"Data range: {result['range_with_headers']}")

wb.save("output.xlsx")

Performance: ~4 seconds for 1M rows × 20 columns on M1 MacBook Pro.

Parquet Export

Export worksheet data to Parquet format with automatic type inference:

import rustypyxl

wb = rustypyxl.load_workbook("data.xlsx")

# Export entire sheet
result = wb.export_to_parquet(
    sheet_name="Sheet1",
    path="output.parquet",
    has_headers=True,              # first row contains headers
    compression="snappy",          # snappy, zstd, gzip, lz4, none
    column_renames={"old": "new"}, # optional: rename columns
    column_types={"date_col": "datetime"},  # optional: force column types
)

print(f"Exported {result['rows_exported']} rows")
print(f"File size: {result['file_size']} bytes")

# Export specific range
result = wb.export_range_to_parquet(
    sheet_name="Sheet1",
    path="subset.parquet",
    min_row=1, min_col=1,
    max_row=1000, max_col=5,
)

Supported column type hints: string, float64, int64, boolean, date, datetime, auto.

Loading from Bytes or File-like Objects

Load workbooks from in-memory bytes or file-like objects:

import rustypyxl
import io

# From bytes
with open("file.xlsx", "rb") as f:
    data = f.read()
wb = rustypyxl.load_workbook(data)

# From file-like object (e.g., BytesIO, HTTP response)
wb = rustypyxl.load_workbook(io.BytesIO(data))

# Save to bytes (for HTTP responses, S3, etc.)
output_bytes = wb.save_to_bytes()

S3 Support

Use save_to_bytes() and load_workbook(bytes) with boto3 for S3 integration:

import boto3
import rustypyxl

s3 = boto3.client("s3")

# Load from S3
response = s3.get_object(Bucket="my-bucket", Key="path/to/file.xlsx")
wb = rustypyxl.load_workbook(response["Body"].read())

# Save to S3
data = wb.save_to_bytes()
s3.put_object(Bucket="my-bucket", Key="path/to/output.xlsx", Body=data)

This works with any S3-compatible service and uses boto3's credential handling (IAM roles, environment variables, etc.).

Streaming Writes (Low Memory)

For very large files, use WriteOnlyWorkbook which streams rows directly to disk:

import rustypyxl

wb = rustypyxl.WriteOnlyWorkbook("large_output.xlsx")
wb.create_sheet("Data")

for i in range(1_000_000):
    wb.append_row([f"Row {i}", i, i * 1.5, i % 2 == 0])

wb.close()  # Must call close() to finalize the file

This uses minimal memory regardless of file size, similar to openpyxl's write_only=True mode.

Benchmarks

Micro benchmarks on M1 MacBook Pro. Your results may vary depending on data characteristics and hardware.

Write Performance (1M rows × 20 columns)

Library Time
rustypyxl ~10s
openpyxl ~200s

Read Performance

Dataset rustypyxl calamine openpyxl
10k × 20 (numeric) 0.08s 0.10s 0.51s
10k × 20 (strings) 0.10s 0.12s 1.23s
100k × 20 (numeric) 0.97s 1.03s 4.74s
100k × 20 (mixed) 1.20s 1.28s 12.1s

calamine is a Rust Excel reader with Python bindings via python-calamine (read-only).

Memory Usage (Read)

Dataset rustypyxl calamine openpyxl
10k × 20 29 MB 9 MB 11 MB
50k × 20 58 MB 48 MB 53 MB
100k × 20 95 MB 95 MB 106 MB

Memory Usage (Write)

Dataset rustypyxl WriteOnlyWorkbook openpyxl (write_only)
10k × 20 10 MB ~0 MB 0.4 MB
50k × 20 50 MB ~0 MB 0.4 MB
100k × 20 99 MB ~0 MB 0.4 MB

WriteOnlyWorkbook streams rows directly to disk like openpyxl's write_only mode.

Building from Source

# Install Rust and maturin
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
pip install maturin

# Build
maturin develop --release

License

MIT

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.

rustypyxl-0.3.0-cp314-cp314-win_amd64.whl (3.6 MB view details)

Uploaded CPython 3.14Windows x86-64

rustypyxl-0.3.0-cp314-cp314-manylinux_2_34_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

rustypyxl-0.3.0-cp314-cp314-macosx_11_0_arm64.whl (3.2 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

rustypyxl-0.3.0-cp313-cp313-win_amd64.whl (3.6 MB view details)

Uploaded CPython 3.13Windows x86-64

rustypyxl-0.3.0-cp313-cp313-manylinux_2_34_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

rustypyxl-0.3.0-cp313-cp313-macosx_11_0_arm64.whl (3.2 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rustypyxl-0.3.0-cp312-cp312-win_amd64.whl (3.6 MB view details)

Uploaded CPython 3.12Windows x86-64

rustypyxl-0.3.0-cp312-cp312-manylinux_2_34_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

rustypyxl-0.3.0-cp312-cp312-macosx_11_0_arm64.whl (3.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

rustypyxl-0.3.0-cp311-cp311-win_amd64.whl (3.6 MB view details)

Uploaded CPython 3.11Windows x86-64

rustypyxl-0.3.0-cp311-cp311-manylinux_2_34_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

rustypyxl-0.3.0-cp311-cp311-macosx_11_0_arm64.whl (3.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

rustypyxl-0.3.0-cp310-cp310-win_amd64.whl (3.6 MB view details)

Uploaded CPython 3.10Windows x86-64

rustypyxl-0.3.0-cp310-cp310-manylinux_2_34_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

rustypyxl-0.3.0-cp310-cp310-macosx_11_0_arm64.whl (3.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file rustypyxl-0.3.0-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: rustypyxl-0.3.0-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rustypyxl-0.3.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 058dbf6f9eed8ec728490acd78668101e52bf11ac20fd343906956e2c6467ae8
MD5 acd06771bbbe0730cf27988667ab3cd9
BLAKE2b-256 428c91284da8f069877e5c60e40ccabb6d72be2c70546d31ef69ccbd288f4334

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypyxl-0.3.0-cp314-cp314-win_amd64.whl:

Publisher: publish.yml on freeeve/rustypyxl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypyxl-0.3.0-cp314-cp314-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for rustypyxl-0.3.0-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 9a1c45b0de8bb4a75bbc7c3863d26542a7a94cdf1ba7cbc369f1d754e74f6b41
MD5 935f393a11cac6e65c0161c9729d53bf
BLAKE2b-256 687a4ef011b8a1d9c42a86eecee3214de363fadd3286b15da8e87dc23faf71f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypyxl-0.3.0-cp314-cp314-manylinux_2_34_x86_64.whl:

Publisher: publish.yml on freeeve/rustypyxl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypyxl-0.3.0-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustypyxl-0.3.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4ed90ef3ddf78f932f0d74a68bae9325d4269a590129afb8ab3c61ae7b96573a
MD5 a31dd9c31c80002bef06b65611942b01
BLAKE2b-256 59862c66a5266b73ad14bfe63efb8ed919dea9641b4a2472d29cd03e33f0bbcc

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypyxl-0.3.0-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: publish.yml on freeeve/rustypyxl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypyxl-0.3.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: rustypyxl-0.3.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rustypyxl-0.3.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 6d6366e12ae8451b4964d33e7a46d09144297c96e10c4cc46eb186f8dc6ca567
MD5 543200ebc86308d0ee9f6d61e3de3d49
BLAKE2b-256 1b5fc7b183e6b68308ff9941588844e665e2625f38e6667171ca1395ded4f9a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypyxl-0.3.0-cp313-cp313-win_amd64.whl:

Publisher: publish.yml on freeeve/rustypyxl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypyxl-0.3.0-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for rustypyxl-0.3.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 2967796dba3f35882bb4bedd9939d031e95927cd6903c62864931d6d613ccf74
MD5 69021c91488f41dd5bdeb37dc05e32cb
BLAKE2b-256 51c60b0c073d736187adf597d71185aa2802a854864e0c63fe1e5f460fbc600b

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypyxl-0.3.0-cp313-cp313-manylinux_2_34_x86_64.whl:

Publisher: publish.yml on freeeve/rustypyxl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypyxl-0.3.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustypyxl-0.3.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 01e18ed3a1b31fd96e72954196c67a59c8abb7ab451ae32fc1513b3859ed236c
MD5 53af351780bf6e5bfeaf537b495df9ea
BLAKE2b-256 03d92d13be0cea306cfa6853cb92b77a72e1c6d2efe479e5e473c2381b50a03c

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypyxl-0.3.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: publish.yml on freeeve/rustypyxl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypyxl-0.3.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: rustypyxl-0.3.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rustypyxl-0.3.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0adc04bdfd4d0c84a791821bad42afbda4718dd2dcb81ce54b52e54923359c4c
MD5 b39a18c46b60161e9876d89e33f4bbab
BLAKE2b-256 d0ac9d5967012ceaac146265bf3ff8631de00bf74f887a32a45519a359ec4526

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypyxl-0.3.0-cp312-cp312-win_amd64.whl:

Publisher: publish.yml on freeeve/rustypyxl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypyxl-0.3.0-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for rustypyxl-0.3.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 1d526fcce71b5f62b3b5ddceb24272650d37bb913bd82a2938ba47d5af7ee094
MD5 a92611ffe9727de86eca3ede6a32ac3c
BLAKE2b-256 d7f3b8284266d664ac330e938905efe419834b47107c4e679efaae480ccf0bf5

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypyxl-0.3.0-cp312-cp312-manylinux_2_34_x86_64.whl:

Publisher: publish.yml on freeeve/rustypyxl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypyxl-0.3.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustypyxl-0.3.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c6700de42caa6d2c500e09a58096eb1152ee2e6bed8d4599bdcd4d7aee7a85c6
MD5 b7d79cda0e2164a31fc030b11a515721
BLAKE2b-256 5ae0cf0ef9b3f0e654b4a98e4b26ecb8afefe9915102a1a93f3beda641eeaf44

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypyxl-0.3.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish.yml on freeeve/rustypyxl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypyxl-0.3.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: rustypyxl-0.3.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rustypyxl-0.3.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5ebf28768b97ad8142b4dcc2907c4f55ea457725b943d92d318350aa4a00e08d
MD5 04c116493bc6cdc1cdcf1305cc5f9841
BLAKE2b-256 4951fd152ddba09bb830f869c557f9d5130179bdc95e31b58554b1e833aad567

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypyxl-0.3.0-cp311-cp311-win_amd64.whl:

Publisher: publish.yml on freeeve/rustypyxl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypyxl-0.3.0-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for rustypyxl-0.3.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 a7b54cc27d84aac96f6916bf8079c579d437eab31e366cdeb89341163cc3c6f4
MD5 71f82e303d7602317a0f3a7948322eb3
BLAKE2b-256 d14c25bb4d9741784050321e81ed93fa19c00934c2d4476a1a861912c2b98b33

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypyxl-0.3.0-cp311-cp311-manylinux_2_34_x86_64.whl:

Publisher: publish.yml on freeeve/rustypyxl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypyxl-0.3.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustypyxl-0.3.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 516f0e787fd47f503b492a122ea3c12619d3d933120040d71035640a61783c2d
MD5 55ce69c025fa4779dde095ef72b729a1
BLAKE2b-256 aa6f0cb054192b613097f107d346a790850a88fb2a511913701b3b001d15bcf3

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypyxl-0.3.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: publish.yml on freeeve/rustypyxl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypyxl-0.3.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: rustypyxl-0.3.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rustypyxl-0.3.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e78ab46443e993aa1983a655b66c6c128a52b2042cd872f461637eb9f2959404
MD5 538c08d48a813ee2758e2198938af6ae
BLAKE2b-256 1003364c49e2c66f691bc442a5722358f16624bdfe1de6ceed5da4713c7e042c

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypyxl-0.3.0-cp310-cp310-win_amd64.whl:

Publisher: publish.yml on freeeve/rustypyxl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypyxl-0.3.0-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for rustypyxl-0.3.0-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 3b5c9dd8dab1723812974820a47f09a72e4afc0dc45d52c27c3188d9d04db1ca
MD5 738298892b359ca99ce0853e14190273
BLAKE2b-256 2f58c7de451f5f78dd353b5d779c37b9d6e9ce53033bd0a19511e2aa524567d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypyxl-0.3.0-cp310-cp310-manylinux_2_34_x86_64.whl:

Publisher: publish.yml on freeeve/rustypyxl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypyxl-0.3.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustypyxl-0.3.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7172784de1a7540246aa44c596df3f24fe6fb5d46b48bc93bb2392c188138fef
MD5 910eaf1b21310d28e385d680269a3462
BLAKE2b-256 11b8bbb9b80642c5411e27e62f44f14368844de4373f28d4e2041b3c509946d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypyxl-0.3.0-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: publish.yml on freeeve/rustypyxl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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