Crates.io | spsheet |
lib.rs | spsheet |
version | 0.1.0 |
source | src |
created_at | 2017-12-20 22:29:16.355319 |
updated_at | 2017-12-20 22:29:16.355319 |
description | A xlsx or ods read and write spreadsheet library |
homepage | |
repository | https://github.com/aoyagikouhei/spsheet-rs |
max_upload_size | |
id | 43782 |
size | 124,718 |
A xlsx or ods read and write library
spsheet-rs is is a pure Rust library to read and write any xlsx and ods file.
extern crate spsheet;
use spsheet::ods;
use spsheet::xlsx;
use spsheet::{Book,Sheet,Cell};
use spsheet::style::Style;
use std::path::Path;
let mut book = Book::new();
let mut sheet = Sheet::new("シート1");
sheet.add_cell(Cell::str("a"), 0, 0);
sheet.add_cell(Cell::str("b"), 0, 1);
sheet.add_cell(Cell::float(1.0), 1, 0);
sheet.add_cell(Cell::float(2.0), 1, 1);
sheet.add_cell(Cell::date_with_style("2017-12-02", Style::new("MM\\月DD\\日")), 2, 0);
sheet.add_cell(Cell::date_with_style("2017-12-02T13:30:00", Style::new("YYYY/MM/DD\\ HH:MM:SS")), 2, 1);
book.add_sheet(sheet);
let _ = ods::write(&book, Path::new("./tests/test.ods"));
let res = ods::read(Path::new("./tests/test.ods")).unwrap();
assert_eq!(book, res);
let _ = xlsx::write(&book, Path::new("./tests/test.xlsx"));
let res = xlsx::read(Path::new("./tests/test.xlsx")).unwrap();
assert_eq!(book, res);
If I can find Google Shreadsheet API Library in Rust, I'll support Google Shpeadsheet.