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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 15.0+ x86-64

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

Uploaded CPython 3.12macOS 15.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 15.0+ x86-64

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

Uploaded CPython 3.11macOS 15.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 15.0+ x86-64

turboxl-0.1.67-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.67-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: turboxl-0.1.67-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.67-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 234794c461249481a0ce82c9de5ee04cbbd74ce6047929f6c76b83856b4c43b6
MD5 4956dc4ef58dc1bd3c16ed2503d6f2aa
BLAKE2b-256 ae4432566e0c0ebfcfa58c2b48c3579f5e55a8542ee1edd9f3b45b459655515e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for turboxl-0.1.67-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 052e014d7c34f0f02046d5c521406caf97cbf0c565f24869e1802667c59f023b
MD5 f554e6a0c70507e24e28f63fc3b24e6f
BLAKE2b-256 00fe8aa485afc14bb3cf77a91b59408e13a058ea6bace60e57544286730fe026

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for turboxl-0.1.67-cp312-cp312-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 d05b5b295a87860c50e5c1c2675b86b5e595ffacd01a5f43cd39563931e990a5
MD5 fac2c45faf4ef2a2fcc0733e9bdc8c17
BLAKE2b-256 3d10987bd52cb66ae7567a39072a6b5d858b8f6960cacaffffdf47432f21f621

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for turboxl-0.1.67-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 260cf30f97f9d9ff5089cce89a9dd16e14a037a7e09c5aed12e40fa54473782d
MD5 cc1a4526110a018eca71b57a3395f739
BLAKE2b-256 8ee0c4b45eedb9e0666f86d861c720ebeb99b62956f4eae3280ec787cd044b6c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: turboxl-0.1.67-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.67-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9ce24d8e3619a9e3ce3c60a6231b9a440fd1d40630e39ca6e9deeef49e63bc0c
MD5 3525306e076ecf6f2473785084958312
BLAKE2b-256 189bd139b8ea2c5904206125c378d697c67d6fd39dcf3bc25dd0e51d730f288c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for turboxl-0.1.67-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 5b99aa546aa656e6135f07d52b5db5008b4b2f4f9482f10cf28ddb6eb9f943ef
MD5 e1e297589787b6cedfb6aa60481f6c63
BLAKE2b-256 d2ff6903ae1de489fbc3055f0b083d900ffbb5f64b8f624b8b2a68a81b9ad87a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for turboxl-0.1.67-cp311-cp311-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 7a295a87b24b8dd0f93fffe383c39f5621ec424df48349ccdd1270de85bcc0b8
MD5 057b4ec56c221999b2bffb0d04b62c3e
BLAKE2b-256 86533b5f32f28500fb59b12db31d48f5f045f734688dc27270a559e29ad77297

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for turboxl-0.1.67-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 302d588b16c56b8f4b37a8708575e6a6aaf17dd3bee14f25680bb32272358a1d
MD5 37712dcecd9e511489b61667dae21156
BLAKE2b-256 27d17e769f460b2844277e706d54e26c15a9ce67410686eba0c5d574e4a8c163

See more details on using hashes here.

File details

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

File metadata

  • Download URL: turboxl-0.1.67-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.67-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 fee036f477c1d1b1dcee017edf59d69cd4c045d31fa3e8de60952796e8cfa49f
MD5 8e7908cbfb9d2ec741c4099aec991dca
BLAKE2b-256 53df6373866ed9204e2fadc39a6d637921a450bf5868e6c21dc8dc0e86e54f02

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for turboxl-0.1.67-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 f654f576b835ea73b4acab78aca0a367dd2cd7e70f91db74b6e24f2f39dcc0dc
MD5 8d3b05ff004215ea1a465b59e0155000
BLAKE2b-256 e18efcf3b386e79629848989463f92b7009d1d2975010babd20b86c2fdc74136

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for turboxl-0.1.67-cp310-cp310-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 b0f9d3224fe3994b16114e295c4b2679856ce155e84cd0a4906176bf75f44e15
MD5 9c697db313af2023e1999a3cc3604b3a
BLAKE2b-256 a54c47635834bfdeebdef147287d573f96695a5c331fa2dc46f646d782302913

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for turboxl-0.1.67-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 ccb1197ffc33ee0106ca8d246d448ef10032d6db0a0a94cec10494e0e01f4890
MD5 7eb6c6d659c18cf8932ca3e452b61b50
BLAKE2b-256 0e995c1b8eb8ec782903594b48e1081b7c796ece40bc9a82f08378c154fb85a7

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