#xlsx #ods #spreadsheet

spsheet

A xlsx or ods read and write spreadsheet library

1 unstable release

Uses old Rust 2015

0.1.0 Dec 20, 2017

#6 in #xlsx

31 downloads per month
Used in dbfish

MIT/Apache

105KB
2K SLoC

spsheet-rs

A xlsx or ods read and write library

Documentation

Description

spsheet-rs is is a pure Rust library to read and write any xlsx and ods file.

Features

  • xlsx Read
  • xlsx Write
  • ods Read
  • ods Write
  • Cell Value
  • Cell Date Format(partialy support)
  • Cell Digit Format
  • Cell Border
  • Cell Color
  • Cell Width
  • Cell Hegiht
  • Formular

Examples

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.

Dependencies

~1.4–3MB
~65K SLoC