Skip to main content

High-performance Excel writer with automatic type detection (pandas, polars, CSV)

Project description

xlsxturbo

High-performance Excel writer with automatic type detection. Written in Rust, usable from Python.

Features

  • Direct DataFrame support for pandas and polars
  • Excel tables - filterable tables with 61 built-in styles (banded rows, autofilter)
  • Auto-fit columns - automatically adjust column widths to fit content
  • Freeze panes - freeze header row for easier scrolling
  • Multi-sheet workbooks - write multiple DataFrames to one file
  • Parallel CSV processing - optional multi-core parsing for large files
  • Automatic type detection from CSV strings and Python objects:
    • Integers and floats → Excel numbers
    • true/false → Excel booleans
    • Dates (2024-01-15, 15/01/2024, etc.) → Excel dates with formatting
    • Datetimes (ISO 8601) → Excel datetimes
    • NaN/Inf → Empty cells (graceful handling)
    • Everything else → Text
  • ~25x faster than pandas + openpyxl
  • Memory efficient - streams data with 1MB buffer
  • Available as both Python library and CLI tool

Installation

pip install xlsxturbo

Or build from source:

pip install maturin
maturin develop --release

Python Usage

DataFrame Export (pandas/polars)

import xlsxturbo
import pandas as pd

# Create a DataFrame
df = pd.DataFrame({
    'name': ['Alice', 'Bob'],
    'age': [30, 25],
    'salary': [50000.50, 60000.75],
    'active': [True, False]
})

# Export to XLSX (preserves types: int, float, bool, date, datetime)
rows, cols = xlsxturbo.df_to_xlsx(df, "output.xlsx")
print(f"Wrote {rows} rows and {cols} columns")

# Works with polars too!
import polars as pl
df_polars = pl.DataFrame({'x': [1, 2, 3], 'y': [4.0, 5.0, 6.0]})
xlsxturbo.df_to_xlsx(df_polars, "polars_output.xlsx", sheet_name="Data")

Excel Tables with Styling

import xlsxturbo
import pandas as pd

df = pd.DataFrame({
    'Product': ['Widget A', 'Widget B', 'Widget C'],
    'Price': [19.99, 29.99, 39.99],
    'Quantity': [100, 75, 50],
})

# Create a styled Excel table with autofilter, banded rows, and auto-fit columns
xlsxturbo.df_to_xlsx(df, "report.xlsx",
    table_style="Medium9",   # Excel's default table style
    autofit=True,            # Fit column widths to content
    freeze_panes=True        # Freeze header row for scrolling
)

# Available styles: Light1-Light21, Medium1-Medium28, Dark1-Dark11
xlsxturbo.df_to_xlsx(df, "dark_table.xlsx", table_style="Dark1", autofit=True)

Multi-Sheet Workbooks

import xlsxturbo
import pandas as pd

# Write multiple DataFrames to separate sheets
df1 = pd.DataFrame({'product': ['A', 'B'], 'sales': [100, 200]})
df2 = pd.DataFrame({'region': ['East', 'West'], 'total': [500, 600]})

xlsxturbo.dfs_to_xlsx([
    (df1, "Products"),
    (df2, "Regions")
], "report.xlsx")

# With styling applied to all sheets
xlsxturbo.dfs_to_xlsx([
    (df1, "Products"),
    (df2, "Regions")
], "styled_report.xlsx", table_style="Medium2", autofit=True, freeze_panes=True)

CSV Conversion

import xlsxturbo

# Convert CSV to XLSX with automatic type detection
rows, cols = xlsxturbo.csv_to_xlsx("input.csv", "output.xlsx")
print(f"Converted {rows} rows and {cols} columns")

# Custom sheet name
xlsxturbo.csv_to_xlsx("data.csv", "report.xlsx", sheet_name="Sales Data")

# For large files (100K+ rows), use parallel processing
xlsxturbo.csv_to_xlsx("big_data.csv", "output.xlsx", parallel=True)

CLI Usage

xlsxturbo input.csv output.xlsx [--sheet-name "Sheet1"] [-v]

Options

  • -s, --sheet-name: Name of the Excel sheet (default: "Sheet1")
  • -v, --verbose: Show progress information

Example

xlsxturbo sales.csv report.xlsx --sheet-name "Q4 Sales" -v

Performance

Benchmarked on 525,684 rows x 98 columns:

Method Time Speedup
xlsxturbo 28.5s 26.7x
PyExcelerate 107s 7.1x
pandas + xlsxwriter 374s 2.0x
pandas + openpyxl 762s 1.0x
polars.write_excel 1039s 0.7x

Type Detection Examples

CSV Value Excel Type Notes
123 Number Integer
3.14159 Number Float
true / FALSE Boolean Case insensitive
2024-01-15 Date Formatted as date
2024-01-15T10:30:00 DateTime ISO 8601 format
NaN Empty Graceful handling
hello world Text Default

Supported date formats: YYYY-MM-DD, YYYY/MM/DD, DD-MM-YYYY, DD/MM/YYYY, MM-DD-YYYY, MM/DD/YYYY

Building from Source

Requires Rust toolchain and maturin:

# Install maturin
pip install maturin

# Development build
maturin develop

# Release build (optimized)
maturin develop --release

# Build wheel for distribution
maturin build --release

Benchmarking

Run the included benchmark script:

# Default: 100K rows x 50 columns
python benchmark.py

# Custom size
python benchmark.py --rows 500000 --cols 100

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 Distribution

xlsxturbo-0.3.0.tar.gz (26.2 kB view details)

Uploaded Source

Built Distributions

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

xlsxturbo-0.3.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (840.0 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

xlsxturbo-0.3.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (842.6 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

xlsxturbo-0.3.0-cp38-abi3-win_amd64.whl (847.8 kB view details)

Uploaded CPython 3.8+Windows x86-64

xlsxturbo-0.3.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (901.9 kB view details)

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

xlsxturbo-0.3.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (842.4 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

xlsxturbo-0.3.0-cp38-abi3-macosx_11_0_arm64.whl (816.0 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

xlsxturbo-0.3.0-cp38-abi3-macosx_10_12_x86_64.whl (860.7 kB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file xlsxturbo-0.3.0.tar.gz.

File metadata

  • Download URL: xlsxturbo-0.3.0.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xlsxturbo-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b1075b405877c0510ae32a039f38e89d01c7fe43375047045e69b2074214c9da
MD5 7f5444e1f3a2c99dcd68e5fa9d87bffa
BLAKE2b-256 345349034bd4e8319fe1fd55d48132e743943478550efba28c7eb256f03a549b

See more details on using hashes here.

Provenance

The following attestation bundles were made for xlsxturbo-0.3.0.tar.gz:

Publisher: release.yml on tstone-1/xlsxturbo

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

File details

Details for the file xlsxturbo-0.3.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for xlsxturbo-0.3.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1c80ecfa25534011f2ed9040992efe6877bb472419db8aa7b79482d95a439e6a
MD5 305d430465b722a1a6819b130a61a9b7
BLAKE2b-256 c375ab717abd1db85e10914090c45387895d098982c0196c0a49300842eea17e

See more details on using hashes here.

Provenance

The following attestation bundles were made for xlsxturbo-0.3.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on tstone-1/xlsxturbo

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

File details

Details for the file xlsxturbo-0.3.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for xlsxturbo-0.3.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 323ddb88ce9dc45906e223dfaccff01d29e47975c7d36d9e91805f297cdfe58d
MD5 df454b72b88a82fa77e88299802957c5
BLAKE2b-256 3c9bf5549765f08ffb31adae532fad94d277fb89b71110194b3f726be3fc0ec3

See more details on using hashes here.

Provenance

The following attestation bundles were made for xlsxturbo-0.3.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on tstone-1/xlsxturbo

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

File details

Details for the file xlsxturbo-0.3.0-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: xlsxturbo-0.3.0-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 847.8 kB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xlsxturbo-0.3.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 ca4da641d4582be16bf6e9486512f3d04e5394406ba7024787c87cea8e57b903
MD5 d117754275a2035f665bcbfa7885ab50
BLAKE2b-256 ae6d530492de73b1da4f69fb665be6e1ce620fff8a9385aaa574ee325409731d

See more details on using hashes here.

Provenance

The following attestation bundles were made for xlsxturbo-0.3.0-cp38-abi3-win_amd64.whl:

Publisher: release.yml on tstone-1/xlsxturbo

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

File details

Details for the file xlsxturbo-0.3.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for xlsxturbo-0.3.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0e9d36bdd44a35aed6259791bfe779136e6501176cfe0a90bf7d0afe39686d9d
MD5 36c2f2ddf6fb99828c81a9631ddb4db3
BLAKE2b-256 0073eb4c92f26c48a32ce500f9af0a9179ba97e0dd52ed995c3cc4d0268540a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for xlsxturbo-0.3.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on tstone-1/xlsxturbo

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

File details

Details for the file xlsxturbo-0.3.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for xlsxturbo-0.3.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3c8d523f6bb57f0e3e3330a6dd02e2d9f4e1300657e4c5923d476ddf9e23ff04
MD5 c5cbea0f5d4e2b887dd9832091f808f8
BLAKE2b-256 55bbd28a86041cffb71fffdd8980b02ddeeae972db7b964bb97aa366ada39147

See more details on using hashes here.

Provenance

The following attestation bundles were made for xlsxturbo-0.3.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on tstone-1/xlsxturbo

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

File details

Details for the file xlsxturbo-0.3.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for xlsxturbo-0.3.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d909484cb0e7dc3460c090f03ce486d7de507de436f468811231de4ec66e3856
MD5 d620fd2a13eaa05d38c71333023e4b08
BLAKE2b-256 e359549be83ad9d0ecd8bcd49698d4ad9212fac1f0963e0fd562f4083eb727d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for xlsxturbo-0.3.0-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on tstone-1/xlsxturbo

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

File details

Details for the file xlsxturbo-0.3.0-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for xlsxturbo-0.3.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 01457359c91a114f65a661396bd65082c5b0ace6d343cc95f54f7810df0c7488
MD5 6737b9631c4854035dfb13582f85e27f
BLAKE2b-256 d15bea9c609a6af16e447a5dbc8f68ab1e13537e575c0413bb6808019b1fb059

See more details on using hashes here.

Provenance

The following attestation bundles were made for xlsxturbo-0.3.0-cp38-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on tstone-1/xlsxturbo

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