calamine
Read and deserialize Excel and OpenDocument spreadsheets in pure Rust.
Repository Health
Technical Analysis
calamine is a pure-Rust library for reading spreadsheet files without any external dependency, native library, or running copy of Excel. It handles the full family of Excel formats — xls, xlsx, xlsm, xlsb, xla, xlam — as well as OpenDocument ods files, exposing their cells, ranges, formulas, and even embedded VBA projects through a single consistent API.
Its standout feature is first-class Serde integration: you can deserialize rows straight into your own structs with a RangeDeserializerBuilder, the same way you would parse JSON. With over ten million downloads it has become the de-facto way to read spreadsheets in Rust, powering data pipelines, ETL jobs, and any service that needs to ingest user-supplied Excel files.
What You Get
- A unified reader for Excel (xls/xlsx/xlsm/xlsb/xla/xlam) and OpenDocument (ods) files
- Serde deserialization of worksheet rows into your own typed structs
- Typed cell access (
Data) covering strings, numbers, bools, dates, and errors - Access to formulas, defined ranges, and merged/covered cells
- VBA macro/module extraction for
.xls-family files - A pure-Rust implementation with no system Excel or native library required
Common Use Cases
- Ingesting user-uploaded Excel files in a web service or API
- ETL and data pipelines that read spreadsheets into typed records
- Batch-converting spreadsheets to CSV, JSON, or database rows
- Auditing or extracting VBA macros from legacy Excel workbooks
Under The Hood
Architecture — calamine is organized by format: xls.rs handles the legacy BIFF/CFB binary format (with cfb.rs for the compound-file container), xlsx/ and xlsb/ handle the OOXML zip-based formats, and ods.rs handles OpenDocument. A common Reader trait plus the Range/Data types in datatype.rs present every format uniformly, while de.rs implements the Serde Deserializer that maps ranges to structs. vba.rs extracts embedded macro projects and formats.rs handles number/date formatting.
Tech Stack — Pure Rust (edition 2021, MSRV 1.88) built on quick-xml for OOXML/ODS parsing, zip for the container, encoding_rs/codepage for text decoding, byteorder and atoi_simd/fast-float2 for fast binary and numeric parsing, and optional chrono for date types. serde powers deserialization.
Code Quality — A mature, well-tested project: an extensive corpus of real-world sample files lives under tests/, exercised with rstest, and criterion benchmarks guard performance. The code is cleanly split per format with shared abstractions, and it is actively maintained.
API Design — Ergonomic and progressive: open_workbook plus worksheet_range gets you a range in a few lines, and the Serde path (RangeDeserializerBuilder) makes typed row mapping feel like parsing JSON. Format-specific reader types are available when you need finer control.