use excelstream::types::CellValue;
use excelstream::ExcelReader;
fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("Streaming read example - Processing large Excel file");
println!("This example demonstrates memory-efficient reading\n");
let mut reader = ExcelReader::open("examples/large_output.xlsx")?;
let mut row_count = 0;
let mut total_sum = 0.0;
println!("Processing rows...");
for row_result in reader.rows("Sheet1")? {
let row = row_result?;
row_count += 1;
for cell in &row.cells {
if let CellValue::String(s) = cell {
if let Ok(value) = s.parse::<f64>() {
total_sum += value;
}
}
}
if row_count % 1000 == 0 {
println!(" Processed {} rows...", row_count);
}
}
println!("\nProcessing complete:");
println!(" Total rows processed: {}", row_count);
println!(" Sum of all numeric values: {}", total_sum);
Ok(())
}