1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
//! Extract plain text from a `.xls` file. //! //! ```text //! cargo run -p rxls --example extract -- path/to/book.xls //! ``` use std::process::ExitCode; fn main() -> ExitCode { let Some(path) = std::env::args().nth(1) else { eprintln!("usage: extract <file.xls>"); return ExitCode::from(64); }; let bytes = match std::fs::read(&path) { Ok(b) => b, Err(e) => { eprintln!("read {path}: {e}"); return ExitCode::from(66); } }; match rxls::extract_text(&bytes) { Ok(text) => { print!("{text}"); ExitCode::SUCCESS } Err(e) => { eprintln!("{path}: {e}"); ExitCode::from(1) } } }