rust_xlsxwriter
The rust_xlsxwriter library is a Rust library for writing Excel files in
the xlsx format.
The rust_xlsxwriter library can be used to write text, numbers, dates, and
formulas to multiple worksheets in a new Excel 2007+ xlsx file. It focuses
on performance and fidelity with the file format created by Excel. It cannot
be used to modify an existing file.
Example
Sample code to generate the Excel file shown above.
use *;
rust_xlsxwriter is a rewrite of the Python XlsxWriter library in Rust by
the same author and with some additional Rust-like features and APIs. The
currently supported features are:
- Support for writing all basic Excel data types.
- Full cell formatting support.
- Formula support, including new Excel 365 dynamic functions.
- Charts.
- Hyperlink support.
- Page/Printing setup support.
- Merged ranges.
- Conditional formatting.
- Data validation.
- Cell Notes.
- Textboxes.
- Checkboxes.
- Sparklines.
- Worksheet PNG/JPEG/GIF/BMP images.
- Rich multi-format strings.
- Outline groupings.
- Defined names.
- Autofilters.
- Worksheet Tables.
- Serde serialization support.
- Support for macros.
- Memory optimization mode for writing large files.
Features
-
default: Includes all the standard functionality. This has a dependency on thezipcrate only. -
constant_memory: This keeps memory usage to a minimum when writing large files. -
serde: Adds support for Serde serialization. This is off by default. -
chrono: Adds support for Chrono date/time types to the API. This is off by default. -
zlib: Adds a dependency onzliband a C compiler. This includes the same features asdefaultbut is 1.5x faster for large files. -
polars: Adds support for mapping betweenPolarsErrorandrust_xlsxwriter::XlsxErrorto make code that handles both types of errors easier to write. -
wasm: Adds a dependency onjs-sysandwasm-bindgento allow compilation for wasm/JavaScript targets. See also wasm-xlsxwriter. -
rust_decimal: Adds support for writing therust_decimalDecimaltype withWorksheet::write(), provided it can be represented by [f64]. -
ryu: Adds a dependency onryu. This speeds up writing numeric worksheet cells for large data files. It gives a performance boost above 300,000 numeric cells and can be up to 30% faster than the default number formatting for 5,000,000 numeric cells.
Release notes
Recent changes:
- Added worksheet outline groupings.
- Added worksheet background images.
- Added support for worksheet checkboxes.
- Added
constant_memorymode.
See the full Release Notes and Changelog.
See also
- User Guide: Working with the
rust_xlsxwriterlibrary.- Getting started: A simple getting started guide on how to use
rust_xlsxwriterin a project and write a Hello World example. - Tutorial: A larger example of using
rust_xlsxwriterto write some expense data to a spreadsheet. - Cookbook.
- Getting started: A simple getting started guide on how to use
- The rust_xlsxwriter crate.
- The rust_xlsxwriter API docs at docs.rs.
- The rust_xlsxwriter repository.
- Roadmap of planned features.