MathNya / umya-spreadsheet

A pure rust library for reading and writing spreadsheet files
MIT License
276 stars 44 forks source link

save flie slow #82

Closed sunnyboy00 closed 1 year ago

sunnyboy00 commented 1 year ago

let path = std::path::Path::new("./1.xlsx"); let mut book = umya_spreadsheet::reader::xlsx::lazy_read(path).unwrap(); let sheet1=book.get_sheet_by_name_mut("Sheet1").unwrap(); sheet1.get_cell_by_column_and_row_mut(&1, &1).set_value("value");

//save let _ = umya_spreadsheet::writer::xlsx::write(&book, path).expect("save error!");

sunnyboy00 commented 1 year ago

I only change one data of the table, but it takes a long time to save

MathNya commented 1 year ago

Thank you for your report. Does Sheet1 of the file that is causing the problem contain a large amount of data? If so, lazy_read will not be very effective. It takes a long time to read and save the file.

In the case of lazy_read, it is effective when editing a sheet that does not contain a large amount of data.

sunnyboy00 commented 1 year ago

You can refer to the implementation of golang, which read and write file fast

github.com/xuri/excelize

MathNya commented 1 year ago

Thank you very much. That sounds like a good hint about speeding up the process. I will refer to it.

MathNya commented 1 year ago

The write process has been reviewed and is now 4 times faster. Please try the latest version.

sunnyboy00 commented 1 year ago

It solved the problem perfectly.

Thank you for your work.