rust-excel
A high-performance Rust toolkit for reading, writing, and modifying Excel (.xlsx) files. Combines three engines for best-in-class speed:
- calamine - fast bulk reads (~2.5x faster than alternatives)
- rust_xlsxwriter - fast file creation (~1.4x faster writes)
- umya-spreadsheet - full in-memory mutation (read + write + modify)
Crates
| Crate | Description |
|---|---|
rust-excel-core |
Library crate for Excel operations. Publish to crates.io. |
rust-excel-api |
REST API server (Axum) with 40+ endpoints. React 19 compatible. |
Quick Start
As a library
[]
= "0.1"
use ;
// Create a new workbook
let mut wb = new;
let ws = wb.get_sheet_mut.unwrap;
// Write cells
set_cell_value;
set_cell_value;
set_cell_value;
set_cell_value;
// Save to bytes
let bytes = wb.save_to_bytes.unwrap;
// Open an existing file
let wb = open.unwrap;
let ws = wb.get_sheet.unwrap;
let val = get_cell_value;
Fast paths
use ;
// Fast bulk read from raw bytes (calamine, 2.5x faster)
let bytes = read.unwrap;
let data = read_data_from_bytes.unwrap;
for row in &data.rows
// Fast file creation (rust_xlsxwriter, 1.4x faster)
let data = RangeData ;
let xlsx_bytes = create_from_data.unwrap;
As a REST API
# Server starts on http://localhost:3001
# Create a workbook
# Upload an Excel file
# Read a cell
# Write a cell
# Bulk read (calamine fast path)
# Download
API Endpoints
Workbooks
POST /workbooks- Create empty workbookPOST /workbooks/upload- Upload .xlsx file (multipart)GET /workbooks/{id}- Get workbook infoGET /workbooks/{id}/download- Download as .xlsxDELETE /workbooks/{id}- Delete workbook
Sheets
GET /workbooks/{id}/sheets- List sheetsPOST /workbooks/{id}/sheets- Add sheetGET /workbooks/{id}/sheets/{name}- Get sheet infoPATCH /workbooks/{id}/sheets/{name}- Rename sheetDELETE /workbooks/{id}/sheets/{name}- Remove sheet
Cells
GET /workbooks/{id}/sheets/{name}/cells/{row}/{col}- Read cellPUT /workbooks/{id}/sheets/{name}/cells/{row}/{col}- Write cellGET /workbooks/{id}/sheets/{name}/data- Bulk read (fast)GET /workbooks/{id}/sheets/{name}/range?r1=&c1=&r2=&c2=- Read rangePUT /workbooks/{id}/sheets/{name}/range- Write range
Rows & Columns
POST /workbooks/{id}/sheets/{name}/rows/{at}- Insert rowsDELETE /workbooks/{id}/sheets/{name}/rows/{at}- Delete rowsPATCH /workbooks/{id}/sheets/{name}/rows/{at}/height- Set row heightPOST /workbooks/{id}/sheets/{name}/columns/{at}- Insert columnsDELETE /workbooks/{id}/sheets/{name}/columns/{at}- Delete columnsPATCH /workbooks/{id}/sheets/{name}/columns/{at}/width- Set column width
Styles
GET /workbooks/{id}/sheets/{name}/cells/{row}/{col}/style- Get stylePATCH /workbooks/{id}/sheets/{name}/cells/{row}/{col}/style- Apply stylePATCH /workbooks/{id}/sheets/{name}/range/style?r1=&c1=&r2=&c2=- Apply range style
Merges
GET /workbooks/{id}/sheets/{name}/merges- List mergesPOST /workbooks/{id}/sheets/{name}/merges- Merge cellsDELETE /workbooks/{id}/sheets/{name}/merges- Unmerge cells
Benchmarks
Measured on 50,000 cells (5000 rows x 10 cols):
| Operation | Time | vs umya-spreadsheet alone |
|---|---|---|
| Read (calamine cached) | 27 ms | 2.5x faster |
| Read (calamine direct) | 27 ms | 2.5x faster |
| Write (rust_xlsxwriter) | 48 ms | 1.4x faster |
| Write (fast, from model) | 54 ms | 1.2x faster |
| Read (umya cell-by-cell) | 66 ms | baseline |
| Write (umya native) | 67 ms | baseline |
Run benchmarks yourself:
Features
- Full cell type support: strings, numbers, booleans, formulas, empty
- Sheet management: add, remove, rename, list
- Range operations: bulk read/write rectangular regions
- Row/column operations: insert, delete, resize
- Cell styling: fonts, colors, borders, alignment, number formats
- Cell merging and unmerging
- Byte-level I/O: open from bytes, save to bytes (no filesystem needed)
- Cached upload bytes for fast subsequent reads
- Automatic dirty tracking with cache invalidation
- Serde serialization for all types
- CORS-enabled REST API for React/frontend integration
License
MIT