xlsx2csv
A fast, memory-efficient converter that turns large XLSX spreadsheets into CSV from the command line or Python.
Repository Health
Technical Analysis
xlsx2csv is a small, dependency-light tool that converts Excel XLSX files to CSV. It streams data out of the spreadsheet’s XML rather than loading the whole workbook into memory, so it stays fast and handles very large files that would overwhelm heavier spreadsheet libraries.
Primarily used as a command-line utility, xlsx2csv can export a single sheet, all sheets at once, or sheets matching include/exclude patterns, with control over delimiters, line terminators, date and float formatting, output encoding, and hyperlink extraction. A single self-contained xlsx2csv.py script also works standalone, and an importable Xlsx2csv class lets you drive conversions from Python code.
What You Get
- A command-line converter from XLSX to CSV that handles very large files
- Single-sheet, all-sheets, and pattern-based sheet selection
- Configurable delimiters, line terminators, date and float formatting
- Output encoding control and optional hyperlink extraction
- A standalone single-file script plus an importable Xlsx2csv Python class
Common Use Cases
- Converting Excel exports to CSV inside shell scripts and ETL pipelines
- Extracting one or many sheets from a workbook into separate CSV files
- Processing huge XLSX files that crash memory-heavy spreadsheet libraries
- Streaming XLSX from STDIN to CSV on STDOUT in data workflows
Under The Hood
Architecture - The entire tool lives in a single xlsx2csv.py module. It opens the XLSX (a ZIP archive) with zipfile, then parses the contained worksheet XML incrementally using an xml.parsers.expat streaming parser. Because rows are emitted through Python’s csv writer as they are parsed, memory stays roughly constant regardless of file size. A CLI argument parser exposes sheet selection, formatting, and encoding options; the same logic is available through the Xlsx2csv class.
Tech Stack - Pure Python using only the standard library (csv, zipfile, xml.parsers.expat, datetime, io), with no third-party runtime dependencies. It targets an unusually wide Python range, from 2.4 through 3.14.
Code Quality - The project is mature (in development since 2010) with 76 contributors, a test/ suite, a maintained CHANGELOG, and a man page. Keeping everything in one dependency-free file is a deliberate design choice that makes it trivial to vendor.
API Design - As a CLI the interface is conventional and well-documented (xlsx2csv input.xlsx output.csv plus flags like -a, -s, -d, -c). The optional Xlsx2csv(...).convert(...) Python API is minimal and mirrors the command-line behavior, so switching between script and library use is straightforward.