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

Uploaded CPython 3.12Windows x86-64

turboxl-0.1.59-cp312-cp312-manylinux_2_28_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

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

Uploaded CPython 3.12macOS 15.0+ x86-64

turboxl-0.1.59-cp312-cp312-macosx_15_0_arm64.whl (992.1 kB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

turboxl-0.1.59-cp311-cp311-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.11Windows x86-64

turboxl-0.1.59-cp311-cp311-manylinux_2_28_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

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

Uploaded CPython 3.11macOS 15.0+ x86-64

turboxl-0.1.59-cp311-cp311-macosx_15_0_arm64.whl (991.9 kB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

turboxl-0.1.59-cp310-cp310-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.10Windows x86-64

turboxl-0.1.59-cp310-cp310-manylinux_2_28_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

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

Uploaded CPython 3.10macOS 15.0+ x86-64

turboxl-0.1.59-cp310-cp310-macosx_15_0_arm64.whl (990.6 kB view details)

Uploaded CPython 3.10macOS 15.0+ ARM64

File details

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

File metadata

  • Download URL: turboxl-0.1.59-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 1.7 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.59-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0371d82ecd8c286c9a31331ee52db20678ff579f866019664aa0e1acdd2dc1d4
MD5 9068f1dc51c9ab10f682e3776f6d86b7
BLAKE2b-256 3e8414585f33e2d9a4a4f66d11a9fd7fcbe0b2b4ffd4d8460820ffad619d2574

See more details on using hashes here.

File details

Details for the file turboxl-0.1.59-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for turboxl-0.1.59-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 05bfd9eed6982f10e1f683e7e82b1fafded81efee6c3afb6318c56c0fa489a06
MD5 67e6798d700d75a9af6a95ec41b689c8
BLAKE2b-256 af1609a7f00e2dc6cb620bb83f6580631d56c4dda149f485837928ff5e411890

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for turboxl-0.1.59-cp312-cp312-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 b4929ca56db82c28a5042cf80144b9ed7c5108d964f0a04c8f5c42f33a53cd0c
MD5 9e88e0787eb865c4a1c77e9c8db9855e
BLAKE2b-256 6221da245aa7102c60ab65deeb8d7ad3da790d390c317e6a44049bcb61c505a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for turboxl-0.1.59-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 ff0e835efb1bde03ae0ecb2ec23e41b39002b67d8e91cff2e3adb93448282f21
MD5 ceb3b35de048708e3e3d5048b06a3498
BLAKE2b-256 48d06ec94cda0f3451e64fe0b5727e08d22e784f6bd55864f0f860c5703f3111

See more details on using hashes here.

File details

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

File metadata

  • Download URL: turboxl-0.1.59-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 1.7 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.59-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 de032983fed9180619d87a1d90d178e7e44aef83302d49ee59e88b1d4a1bcbb8
MD5 a7d2f59166a3957fe75e53a78d0a4e3f
BLAKE2b-256 cde151827895af996f4fd98e2e0b65664a69ae05c7e0788711ee439c559daf30

See more details on using hashes here.

File details

Details for the file turboxl-0.1.59-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for turboxl-0.1.59-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 17fb8362de5a8b00cc255a1af2aab111e2796a30139a5750556f3ec5f92d8d07
MD5 bedfcdf373cd19a87710f0c07dcc9a90
BLAKE2b-256 defdaea0e25d5049f1b95add635553934b7f15c58d0a5293810ed4d110f460ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for turboxl-0.1.59-cp311-cp311-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 4a026cd315a77d2cc3ee4a5236bcdcc65dfca3446f8a174ff2e28255a4c05d84
MD5 c20342a7270ed9e2fa62fb8feefe59b9
BLAKE2b-256 9000a249bd0c5b242008cf5e7255993273b2de119f6184022ae75f9720c12929

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for turboxl-0.1.59-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 12998453083ceb09ceb3cb45a99bc8cd02b9e1e43afed69f471989cab6f1e152
MD5 91cbcbe9822ec72d19e0fede74662241
BLAKE2b-256 a687ff0378e358deafd6dc35d409c6e36adc43ba66d2104c87657e23facc12f2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: turboxl-0.1.59-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 1.7 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.59-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1ac5476351af3a7fee050db5c3883a8527a391a652f85534c828cfad69c1edd9
MD5 3b39f7a95900a5ec1eee29eb87e6c143
BLAKE2b-256 62191b5318051acfd043fad9086bc6c6076ac37c0a90eb9fdfe069eb5823d110

See more details on using hashes here.

File details

Details for the file turboxl-0.1.59-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for turboxl-0.1.59-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2a820e6542e1d3073683703df6009f8119958168574a80b2dd24049f5af6530d
MD5 eab1d98459ac830f96a508fc79f4a80b
BLAKE2b-256 4ec01fedb9b2e75a0496870eea5a14a09656de976dada6f11e68a24264808696

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for turboxl-0.1.59-cp310-cp310-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 005fed9a357c9f2ec57cc77ceae79aa542d8f297fdbdc4b6c0224c1f03708236
MD5 0fa962e18773dd2e658023688ca19000
BLAKE2b-256 5cd4e113fa48d256814631752eaf1280551708f53acf0063ba9013a92d6fdb2d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for turboxl-0.1.59-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 3e63261aedee04711de2969da022a01c96d21387420f9436f0741a6cb934596b
MD5 365442107b20feb2f6a437fa9bcb67d0
BLAKE2b-256 c7b3d47a81f11106cc52084c13064815559c16550332acd46df911b849053abd

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