use calamine::{open_workbook, Reader, Xlsx};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let path = "PATH_TO_FILE";
let mut workbook: Xlsx<_> = open_workbook(path)?;
dbg!(workbook.worksheet_range("Sheet1"));
Ok(())
}
Note: Directly opening and saving the file in Excel may auto-correct the s attributes, thus altering the test conditions.
Possible Cause
The issue likely stems from the read_v function, which attempts to convert style attributes into integers. When an s attribute is an empty string, the conversion fails, leading to the error.
A potential fix could involve modifying the read_v function to handle empty s attributes gracefully, either by ignoring them or by assigning a default style value.
Description
Reading an Excel file that contains empty
s
attributes(s="")
results in aParseIntError
.Steps to reproduce
Download an example file from Colombia's National Tax and Customs Department: https://www.dian.gov.co/dian/cifras/Basesestadisticasimportaciones/01_Importaciones_2018_Enero.zip
Attempt to parse the file:
s
attributes, thus altering the test conditions.Possible Cause
The issue likely stems from the
read_v
function, which attempts to convert style attributes into integers. When ans
attribute is an empty string, the conversion fails, leading to the error.https://github.com/tafia/calamine/blob/953d80ee66d80ecbeabf14670841ea6cc0e1b006/src/xlsx/cells_reader.rs#L236-L241
Suggested fix
A potential fix could involve modifying the
read_v
function to handle emptys
attributes gracefully, either by ignoring them or by assigning a default style value.