You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
let cell_format = matchget_attribute(c_element.attributes(),QName(b"s")){
Ok(Some(style)) => {
let id:usize = std::str::from_utf8(style).unwrap_or("0").parse()?;
formats.get(id)
}
_ => Some(&CellFormat::Other),
Suggested fix
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.
The text was updated successfully, but these errors were encountered:
jlondonobo
changed the title
Parse Integer Error from Excel files with empty s attributes.
Parse Integer Error from Excel files with empty s attributes
Apr 7, 2024
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.calamine/src/xlsx/cells_reader.rs
Lines 236 to 241 in 953d80e
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.The text was updated successfully, but these errors were encountered: