There are several Rust crates available for parsing (reading) .xlsx Excel files. Here are the most notable options:
1. Calamine
Description: Calamine is the most widely used and mature Rust library for reading Excel files, including .xlsx, .xls, .xlsm, .xlsb, and OpenDocument spreadsheets (.ods). It is read-only and does not support writing or modifying Excel files.
Features:
Pure Rust implementation
Supports reading cell values, VBA code, defined names, and formulas
Handles large files efficiently and is benchmarked as faster than many alternatives in other languages
Provides Serde deserialization for easy mapping to Rust structs
Limitations: Read-only (cannot write or modify Excel files), limited support for formatting and advanced Excel features[3][7].
Example Usage:
rust
use calamine::{open_workbook, Reader, Xlsx};
let mut workbook: Xlsx<_> = open_workbook("file.xlsx")?;
if let Some(Ok(range)) = workbook.worksheet_range("Sheet1") {
for row in range.rows() {
println!("{:?}", row);
}
}
Crate:calamine[3]
2. excel_reader
Description:excel_reader is a newer, pure Rust library specifically for reading and parsing .xlsx files.
Features:
Provides an overview of sheets in the workbook
Allows access to cell values and sheet data
Limitations: Less mature and less feature-rich than Calamine; focused on .xlsx only[4].
Crate:excel_reader[4]
3. Integration with DataFrames (Polars, etc.)
Polars: While the Polars crate for Rust does not natively support reading Excel files, it can interoperate with Calamine. You can use Calamine to read .xlsx files and then construct a Polars DataFrame from the extracted data[2][7].
Comparison Table
Crate
Read XLSX
Write XLSX
Other Formats
Notes
calamine
Yes
No
xls, xlsm, xlsb, ods
Most mature, fast, read-only
excel_reader
Yes
No
No
Newer, .xlsx only
rust_xlsxwriter
No
Yes
No
Write-only, no reading
For Writing XLSX Files
If you also need to write or create .xlsx files, consider [rust_xlsxwriter][6]. However, it does not support reading existing files.
Summary:
For parsing .xlsx files in Rust, Calamine is the most robust and widely used option, supporting a variety of Excel and OpenDocument formats with efficient performance. For .xlsx-only projects, excel_reader is a lightweight alternative. If you need to write Excel files, use rust_xlsxwriter, but note it does not support reading[3][4][6].