umya-spreadsheet
Description
umya-spreadsheet is a library written in pure Rust to read and write xlsx file.
Chatting
Please use Gitter for brief chats.
New features
ver 1.2.0
Changing Reference of Option to Optional Reference. (Thank you, agentjill .)
- This version contains breaking change. here
A helper is provided to enter the date into the cell.
let value = convert_date;
let mut numbering_format = default;
numbering_format.set_format_code;
sheet.get_cell_mut.set_value_number;
let result = sheet.get_formatted_value;
assert_eq!;
Other Bug Fixes.
Usage
Installation
Add the following code to Cargo.toml
[]
= "1.2.3"
Add the following code to main.rs
extern crate umya_spreadsheet;
Read file
let path = new;
let mut book = read.unwrap;
Read file (Lazy)
Delays the loading of the worksheet until it is needed.
When loading a file with a large amount of data, response improvement can be expected.
let path = new;
let mut book = lazy_read.unwrap;
New file
let mut book = new_file;
Write file
let path = new;
let _ = write;
Write file with password
let path = new;
let _ = write_with_password;
let from_path = new;
let to_path = new;
let _ = set_password;
Read Value
let mut book = new_file;
book.get_sheet_by_name.unwrap.get_cell.get_value;
book.get_sheet_by_name.unwrap.get_cell.get_value;
book.get_sheet_by_name.unwrap.get_cell.get_value;
book.get_sheet_mut.unwrap.get_cell.get_value;
Change Value
let mut book = new_file;
book.get_sheet_by_name_mut.unwrap.get_cell_mut.set_value;
book.get_sheet_mut.unwrap.get_cell_mut.set_value;
Move Values
let range = "A1:A3";
let row = 10;
let column = 2;
book.get_sheet_by_name_mut.unwrap.move_range;
Change Style
let mut book = new_file;
let mut style = book.get_sheet_by_name_mut.unwrap.get_style_mut;
// fill color on red.
style.set_background_color;
New Chart
let mut book = new_file;
// Add Chart
let mut from_marker = default;
from_marker.set_coordinate;
let mut to_marker = default;
to_marker.set_coordinate;
let area_chart_series_list = vec!;
let mut chart = default;
chart.new_chart;
book.get_sheet_by_name_mut.unwrap
.add_chart;
Struct
Pass the book as a Spreadsheet
to modify it in other functions.
let mut book = new_file;
let _ = book.new_sheet;
update_excel;
See the next chapter for implementation status and more detailed usage.
Support Status
Function | detail | example |
---|---|---|
file reader | xlsx, xlsm | here. |
file lazy_reader | xlsx, xlsm | here. |
file writer | xlsx, xlsm | here. |
csv | here. | |
file writer with password | xlsx, xlsm | here. |
worksheet | read, new, copy | here. |
cell value | read, edit, formated value. | here. |
cell style | read, edit | here. |
columns | read, edit, auto width | here. |
rows | read, edit | |
charts | read, edit | here. |
drawings | read, edit(Still might be inconvenient.) | |
images | read, edit | here. |
ole objects | read, edit(Still might be inconvenient.) |
License
MIT
Contributing
Contributions by way of pull requests are welcome! Please make sure your code uses:
cargo fmt
for formatting- clippy