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.70-cp312-cp312-win_amd64.whl (8.8 MB view details)

Uploaded CPython 3.12Windows x86-64

turboxl-0.1.70-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.70-cp312-cp312-macosx_15_0_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.12macOS 15.0+ x86-64

turboxl-0.1.70-cp312-cp312-macosx_15_0_arm64.whl (999.9 kB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

turboxl-0.1.70-cp311-cp311-win_amd64.whl (8.8 MB view details)

Uploaded CPython 3.11Windows x86-64

turboxl-0.1.70-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.70-cp311-cp311-macosx_15_0_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11macOS 15.0+ x86-64

turboxl-0.1.70-cp311-cp311-macosx_15_0_arm64.whl (998.9 kB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

turboxl-0.1.70-cp310-cp310-win_amd64.whl (8.8 MB view details)

Uploaded CPython 3.10Windows x86-64

turboxl-0.1.70-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.70-cp310-cp310-macosx_15_0_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.10macOS 15.0+ x86-64

turboxl-0.1.70-cp310-cp310-macosx_15_0_arm64.whl (997.7 kB view details)

Uploaded CPython 3.10macOS 15.0+ ARM64

File details

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

File metadata

  • Download URL: turboxl-0.1.70-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 8.8 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.70-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ea799c1f9ef2e15e55f8c0334aac07d24a341593fca24ce150217f99dbe443ff
MD5 4c8af7587eaa3aa1673fa41fe4bb0614
BLAKE2b-256 8451fcb6f547db2dbcd0484b5e047befa6512ef4dd7f8d7805a5aba498d2fb24

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for turboxl-0.1.70-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 19bd06d6be78b5a96ea433cb1c505b44895d710500c44015b4afc3d74b8404b9
MD5 39a0697f1f47771433f083320f907fda
BLAKE2b-256 9176df5d6cde877324b3022ecff0ff9dcb853f87df84c9120e29472caf26ed3b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for turboxl-0.1.70-cp312-cp312-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 6db9e29467c012d3df73a871fe90860ccd7fbeeadf2f7f3510fd2277e071290f
MD5 b60097794e3403fc7999d40b4030e57e
BLAKE2b-256 1cf6d6c8399575c0ff75b6a34925207e71495f5405c28198d866171ff2c6e0b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for turboxl-0.1.70-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 2fbdc2c7938daf8e2de00d0e14cdb90d5e284f409d91782664086332c1e1cce4
MD5 7e7deda8d2db96adf0440825eab6b717
BLAKE2b-256 3b1315fdc67cad180bb3c9c4bca2fc17915d658a896cbb51c060b77b0dc87f21

See more details on using hashes here.

File details

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

File metadata

  • Download URL: turboxl-0.1.70-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 8.8 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.70-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 606ccbe6b9eb9ade2d82456adf776bb2e3384cf32939d48cd1fd1c6a53536ad9
MD5 6ffe255c7bd5d90019db18446ddea4f4
BLAKE2b-256 a808bea8fd7cece16e03b959af9cf065a838fac5df006d72bed2b946d7cd5d55

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for turboxl-0.1.70-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 c4b2089399982c00705bfd924b75a3b5d3903f794d9fc715aad05b3440e8f58f
MD5 aa953b599267c00668453092ee6bb8ab
BLAKE2b-256 da01a448ff01d940ca1de12ae1796776b7d12dc4677d63b5b46d64975dd645c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for turboxl-0.1.70-cp311-cp311-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 822b9ab62a296746c3b3d3745fdfca80b109e7693f838f9a37c3129be547cc5e
MD5 d818e44b75a50b488a2e960254a8e156
BLAKE2b-256 3632c0bb9044cf9806ce53daf49432a34cf09564837e6f8bcc2f450d692ad7fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for turboxl-0.1.70-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 3ebaa82df3e6d64331431961ed86934938c992ed430367dd347153e72b806b23
MD5 884a4705fccb11a760c18c650b10925b
BLAKE2b-256 9b8b1c526d24a0dc496eaae952776f4511ad917db79c536633986793971bf6dc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: turboxl-0.1.70-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 8.8 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.70-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 bc7ff89d9f7752eee79da9840270ce5042c3943cfd2e26e96b0ae6cc57741732
MD5 8236d6e476e1863e8f464824fd217dda
BLAKE2b-256 c77859e986503730c07a2c29824e59da13baadf7b2f4af66392f530e8189f53f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for turboxl-0.1.70-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 81db4e021a0369ca1b6ddd9b96f967f34f75e9b1db7c6250b8a3bb22530c60cb
MD5 14967bcef673bc7633a9a5da934e48c4
BLAKE2b-256 d240c1d0c89d15ef09ab72c4fc9b8a091ad5ee6657b76f4f7131e07d2cd3733b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for turboxl-0.1.70-cp310-cp310-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 7fa0b82c1923bcfb00b7bad4305449f6b47a792c9b51345f3e3127f23970a96d
MD5 5a7c150eb006fc2d068e300ef32b04fa
BLAKE2b-256 7c93016d19c10bd227a9d4f1bfa1881da414f3c8991383b101aab41507a77263

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for turboxl-0.1.70-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 2fa5d3322fb71acccc399500fe2eb55bbf292cb15506d02a22eb82494a16a329
MD5 d839d3a5a99d2e9c9c14e8b31144a247
BLAKE2b-256 b703d54faccd86d1cf96bfb8d307a59ac27e6075a9c9b0773da0f4825563ea0d

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