MathNya / umya-spreadsheet

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

How to read an encrypted xlsx? #130

Closed Zzaniu closed 9 months ago

Zzaniu commented 9 months ago

I already know how to save an xlsx file and set a password with umya_spreadsheet. But how do I open an encrypted xlsx file with umya_spreadsheet?

Zzaniu commented 9 months ago

This code works correctly


use office_crypto::decrypt_from_file;
use std::io::Cursor;

let file_name = "xxx.xlsx";
let ret = decrypt_from_file(file_name, "password").unwrap();
let mut spreadsheet = umya_spreadsheet::reader::xlsx::read_reader(Cursor::new(ret), true).unwrap();
...