Skip to main content

Crate excel_rs

Crate excel_rs 

Source
Expand description

A fast, low-allocation library for writing XLSX (Excel Open XML) files.

excel-rs-xlsx streams cell data directly into a ZIP-compressed XLSX archive, flushing to the underlying writer in batches. It never materialises the full file in memory, which makes it suitable for large datasets.

§Quick start

use std::fs::File;
use excel_rs::{WorkBook, sheet::CellType};

let file = File::create("output.xlsx").unwrap();
let mut wb = WorkBook::new(file);

let mut sheet = wb.new_worksheet("Sales".to_string()).unwrap();
sheet.write_row([b"Name".as_ref(), b"Revenue"].into_iter(), None).unwrap();
sheet.write_row([b"Alice".as_ref(), b"42000"].into_iter(), Some(&[CellType::String, CellType::Number])).unwrap();
sheet.close().unwrap();

wb.finish().unwrap();

§Limits

These match the OOXML / Excel specification:

LimitValue
Rows per sheet1 048 576
Columns per sheet16 384
Sheets per workbook65 535

Re-exports§

pub use error::ExcelError;
pub use error::Result;
pub use workbook::WorkBook;

Modules§

error
sheet
workbook

Constants§

MAX_COLS
Maximum number of columns per worksheet (Excel limit).
MAX_ROWS
Maximum number of rows per worksheet (Excel limit).
MAX_SHEETS
Maximum number of worksheets per workbook (Excel limit).