Skip to main content

Fast XLSX to CSV converter (C++ core with Python bindings)

Project description

TurboXL

TurboXL Logo

Fast, read-only XLSX to CSV converter with C++20 core and Python bindings.

Performance

Real-world benchmarks on Chicago Crime dataset (21.9MB, 146,574 rows):

Metric TurboXL OpenPyXL Improvement
Speed 2.4s 63.1s 26.7x faster
Memory 33.5MB 66.9MB 2.0x less
Throughput 62,040 rows/sec 2,321 rows/sec 26.7x faster

Dataset: Chicago Crimes 2025

🚀 Recent Optimizations Implemented:

  • zlib-ng integration - Up to 2.5x faster ZIP decompression
  • Release build optimizations - -O3 -march=native -flto for GCC/Clang, /O2 /GL /arch:AVX2 for MSVC
  • Arena-based shared strings - Memory-efficient string storage
  • Chunked ZIP reading - 512 KiB buffer optimization

What It Does

  • ✅ Read XLSX files and convert to CSV
  • ✅ Handle shared strings, numbers, dates, booleans
  • ✅ Process multiple worksheets
  • ✅ Memory-efficient streaming (33.5MB for 146k rows)
  • ✅ Cross-platform (Linux, macOS, Windows)

What It Doesn't Do

  • ❌ Write or modify XLSX files
  • ❌ Formula evaluation (uses cached values)
  • ❌ Charts, images, pivot tables
  • ❌ Password-protected files

Quick Start

Python

import turboxl

# Convert first sheet
csv_data = turboxl.read_sheet_to_csv("data.xlsx")

# Convert specific sheet
csv_data = turboxl.read_sheet_to_csv("data.xlsx", sheet="Sheet2")

# Custom options
csv_data = turboxl.read_sheet_to_csv(
    "data.xlsx",
    sheet=0,
    delimiter=";",
    date_mode="iso"
)

# Save to file
with open("output.csv", "w", encoding="utf-8") as f:
    f.write(csv_data)

C++

#include <xlsxcsv.hpp>
#include <iostream>

int main() {
    try {
        std::string csv = xlsxcsv::readSheetToCsv("data.xlsx");
        std::cout << csv << std::endl;
    } catch (const std::exception& e) {
        std::cerr << "Error: " << e.what() << std::endl;
    }
    return 0;
}

Building

Prerequisites

Install system dependencies (used via pkg-config/CMake):

# macOS (Recommended for best performance)
brew install libxml2 minizip-ng zlib-ng cmake pybind11 pkg-config

# Ubuntu/Debian (Recommended for best performance)
sudo apt-get install -y libxml2-dev libminizip-dev cmake build-essential pkg-config
# For zlib-ng on Ubuntu/Debian, build from source:
# git clone https://github.com/zlib-ng/zlib-ng.git
# cd zlib-ng && cmake -B build && cmake --build build -j && sudo cmake --install build

# Windows (vcpkg)
vcpkg install libxml2 minizip-ng zlib-ng

Performance Note: Installing zlib-ng provides significant performance improvements (up to 2.5x faster decompression). The build system automatically detects and uses zlib-ng if available, falling back to standard zlib otherwise.

Build C++ Core (library only)

Build the C++ core without Python bindings (no Python/pybind11 required):

# From repo root
cmake -S . -B build \
  -DCMAKE_BUILD_TYPE=Release \
  -DBUILD_TESTS=OFF \
  -DBUILD_PYTHON=OFF \
  -DBUILD_CLI=OFF
cmake --build build -j4

Artifacts:

  • Static library: build/libturboxl_core.a

Build Modes:

  • Release (Recommended): Enables -O3 -march=native -flto optimizations
  • Debug: Enables debugging symbols and assertions

Build Options

  • BUILD_TESTS=ON/OFF - Build test suite (default: ON)
  • BUILD_PYTHON=ON/OFF - Build Python bindings (default: ON)
  • BUILD_CLI=ON/OFF - Build command-line tool (default: OFF)

Python Wheel

TurboXL ships a PEP 517/518 build powered by scikit-build-core. The wheel builds the C++ core and Python extension in Release mode using CMake.

Python prerequisites

python3 -m pip install -U pip build scikit-build-core pybind11

System dependencies listed above (libxml2, minizip-ng, zlib-ng, cmake, compiler) must be installed and discoverable by CMake/pkg-config.

Build the wheel

# From repo root
python3 -m build -w

Outputs go to dist/, for example:

  • dist/turboxl-0.1.0-<python>-<abi>-<platform>.whl

Install the built wheel locally:

pip install python/dist/turboxl-*.whl

Tips:

  • Parallel CMake build: CMAKE_BUILD_PARALLEL_LEVEL=4 python3 -m build -w
  • macOS arch (defaults to arm64 via pyproject.toml): to override, you can pass --config-setting=cmake.define.CMAKE_OSX_ARCHITECTURES="arm64;x86_64" to python -m build.

Requirements

  • C++: C++20 compiler (GCC 10+, Clang 12+, MSVC 2019+)
  • Build: CMake 3.20+
  • Python: 3.8-3.12 (for Python bindings)

API Reference

Python

turboxl.read_sheet_to_csv(
    xlsx_path: str,
    sheet: Union[str, int] = None,  # First sheet if None
    delimiter: str = ",",
    newline: Literal["LF", "CRLF"] = "LF",
    include_bom: bool = False,
    date_mode: Literal["iso", "rawNumber"] = "iso"
) -> str

C++

struct CsvOptions {
    std::string sheetByName;
    int sheetByIndex = -1;
    char delimiter = ',';
    bool includeBom = false;
    // ... more options
};

std::string readSheetToCsv(
    const std::string& xlsxPath,
    const CsvOptions& opts = {}
);

License

MIT License - see LICENSE file for details.

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.

turboxl-0.1.68-cp312-cp312-win_amd64.whl (8.4 MB view details)

Uploaded CPython 3.12Windows x86-64

turboxl-0.1.68-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

turboxl-0.1.68-cp312-cp312-macosx_15_0_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.12macOS 15.0+ x86-64

turboxl-0.1.68-cp312-cp312-macosx_15_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

turboxl-0.1.68-cp311-cp311-win_amd64.whl (8.4 MB view details)

Uploaded CPython 3.11Windows x86-64

turboxl-0.1.68-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

turboxl-0.1.68-cp311-cp311-macosx_15_0_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11macOS 15.0+ x86-64

turboxl-0.1.68-cp311-cp311-macosx_15_0_arm64.whl (999.4 kB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

turboxl-0.1.68-cp310-cp310-win_amd64.whl (8.4 MB view details)

Uploaded CPython 3.10Windows x86-64

turboxl-0.1.68-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

turboxl-0.1.68-cp310-cp310-macosx_15_0_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.10macOS 15.0+ x86-64

turboxl-0.1.68-cp310-cp310-macosx_15_0_arm64.whl (998.0 kB view details)

Uploaded CPython 3.10macOS 15.0+ ARM64

File details

Details for the file turboxl-0.1.68-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: turboxl-0.1.68-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 8.4 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for turboxl-0.1.68-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f9db0bc6bb4dbe0e8afe86ffa404bdb408fa5812ecad9e83a1d0e6bf7ad67e3b
MD5 6df9a4d83aceb8ccbfd5486cde958738
BLAKE2b-256 fff8a49a790f9626c556c42dc6bb435a34257408d85a473cf0a322d76aa6ff03

See more details on using hashes here.

File details

Details for the file turboxl-0.1.68-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for turboxl-0.1.68-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 ff27478b586d4e2a6c2242f2c985ec2b05b0e591149bbeb92483c16748e3aca3
MD5 d558aa7b6abe9fbfff1c30e00ac0ed70
BLAKE2b-256 2e39fa78d78cafe7db0990c5344502c872217df3d5ebf4ef28edde5a04edf9b4

See more details on using hashes here.

File details

Details for the file turboxl-0.1.68-cp312-cp312-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for turboxl-0.1.68-cp312-cp312-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 3ac72da009f1721bf0b4e02897cb12a76ee419420f8206a3b0c49623f982c993
MD5 c9b615a349167822b4b7136392be18e4
BLAKE2b-256 4cc27c1e1a82070fe7ea5937bef71e92b1fcc5f8b5f977f2489d31ec10873e76

See more details on using hashes here.

File details

Details for the file turboxl-0.1.68-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for turboxl-0.1.68-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 959fb0a661f0b9ed281cbb635b3bc2197f2f336711e6b9565d257508623de82b
MD5 2ebc40167b6b7f70326e1296ce9820f8
BLAKE2b-256 c616b4afbe2f8eb66c8a0c0590a7d90bd36ba8e74b7a40876c844fac9a4363cd

See more details on using hashes here.

File details

Details for the file turboxl-0.1.68-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: turboxl-0.1.68-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 8.4 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for turboxl-0.1.68-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 60b1c56865276a32567cd5fbea267be9aa307aec870efd02e01b58b172624147
MD5 2b63f8946b4ea9118e80b3b35ba8d80d
BLAKE2b-256 4433f554b8ec6a6444ecece635ab3804d1b3fb3b1052177e002e7afff6cf2db9

See more details on using hashes here.

File details

Details for the file turboxl-0.1.68-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for turboxl-0.1.68-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 cf88fb03d4cf03b298f72cd6371e11db47d49b4c11e0ed59d7d24c3c0787a4ee
MD5 dded6f5a1329aa08848add8d3d7f2260
BLAKE2b-256 3bfc7767a6f85a726f926a3fd99c7fc71a53f02e994abb49430176ec07684aec

See more details on using hashes here.

File details

Details for the file turboxl-0.1.68-cp311-cp311-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for turboxl-0.1.68-cp311-cp311-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 dc9126cf2c555e8c66b55669149ac30c15b18661f6bc31487370cd8cd71c8a04
MD5 7ea76a2253b4513e787d33bee1f7e6f0
BLAKE2b-256 c437ed00a0dc38704aa46bc2a8697797545d7879c91d465aca4606fbd6f3b0b4

See more details on using hashes here.

File details

Details for the file turboxl-0.1.68-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for turboxl-0.1.68-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 0c4e4ebff5be10aac5c8844919a2d9c83e6105accdd0331725f0c9a1a6a08fbb
MD5 656fa05ad0bcd52f9187019d27b232c2
BLAKE2b-256 bcb094302e0e4646d5483580fcec89b4c150e7f8dfd2ce1a1f528eac1865a46b

See more details on using hashes here.

File details

Details for the file turboxl-0.1.68-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: turboxl-0.1.68-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 8.4 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for turboxl-0.1.68-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 3742019d5ac2d73ad387b263a790eebce16e987b53fa32a1de56e540a9664fbb
MD5 b31d77a157cf19e466de510247788383
BLAKE2b-256 a5adf08fbee105f74f8f51c63edc27f2bef47f70e1b0e92aeacefee85302130e

See more details on using hashes here.

File details

Details for the file turboxl-0.1.68-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for turboxl-0.1.68-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 ab1bc79010e082025aaaaac92ef953ba13324dcc70e2361a4d734f6e004d34bf
MD5 712dc0a515ecbe80598ec5ba60c3ee0a
BLAKE2b-256 e76e97a93c40d5e5577d447b1509b2865ce40b260c4ef71fb799e8f1146fa400

See more details on using hashes here.

File details

Details for the file turboxl-0.1.68-cp310-cp310-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for turboxl-0.1.68-cp310-cp310-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 e282598662b7c22d090e5a7b2c4fa840c9dab0b9fcf4ab96bbb4ba1ab5cd2b0c
MD5 6abe1f4c51536da2cfefbaa15a40b66d
BLAKE2b-256 b3a5755fcc9573bbb02e03d9f250b2f4de6b5f7ce7daf4d05e8829dd8f7984a8

See more details on using hashes here.

File details

Details for the file turboxl-0.1.68-cp310-cp310-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for turboxl-0.1.68-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 368e62e9d84ed185ea59d5466d277a846eafe3f52defdd05668940d82d83c286
MD5 cddf0f49ceea9095b748a9d5d8c20d30
BLAKE2b-256 77178c78e407ecdd46ac5603e92ea8d13403c7d03a98801426605e5fa5b775f9

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