#excel #spreadsheet #xlsx #reader #writer

umya-spreadsheet

umya-spreadsheet is a library written in pure Rust and read and write xlsx file

10 releases

Uses old Rust 2015

new 0.1.11-beta Sep 17, 2020
0.1.10-beta Sep 8, 2020
0.1.5-beta Aug 28, 2020

#30 in Windows APIs

50 downloads per month

MIT license

385KB
9K SLoC

umya-spreadsheet

Crates.io Crates.io

Description

umya-spreadsheet is a library written in pure Rust and read and write xlsx file.

Caution

This is BETA version.

  • It contains many bugs.
  • Often changes are not backward compatible.

Example

Result Image

extern crate umya_spreadsheet;

// reader
let path = std::path::Path::new("C:/spread_test_data/aaa.xlsx");
let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap();
// or
// new file
let mut book = umya_spreadsheet::new_file();

// new worksheet
let _ = book.new_sheet("Sheet2");

// change value
let _ = book.get_sheet_by_name_mut("Sheet2").unwrap().get_cell_mut("A1").set_value("TEST1");
// or
let _ = book.get_sheet_mut(1).get_cell_by_column_and_row_mut(1, 1).set_value("TEST1");

// read value
let a1_value = book.get_sheet_by_name("Sheet2").unwrap().get_cell("A1").unwrap().get_value();
// or
let a1_value = book.get_sheet(1).unwrap().get_cell_by_column_and_row(1, 1).unwrap().get_value();
assert_eq!("TEST1", a1_value);  // TEST1

// add bottom border
let _ = book.get_sheet_by_name_mut("Sheet2").unwrap()
.get_style_mut("A1")
.get_borders_mut()
.get_bottom_mut()
.set_border_style(umya_spreadsheet::Border::BORDER_MEDIUM);

// writer
let path = std::path::Path::new("C:/spread_test_data/bbb.xlsx");
let _ = umya_spreadsheet::writer::xlsx::write(&book, path);

License

MIT

Dependencies

~3.5–4.5MB
~101K SLoC