diff --git a/Cargo.lock b/Cargo.lock index 5a94ec7..ca2ee2d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -344,7 +344,7 @@ dependencies = [ [[package]] name = "fastexcel" -version = "0.9.0" +version = "0.9.1" dependencies = [ "anyhow", "arrow", diff --git a/Cargo.toml b/Cargo.toml index e557bee..db68117 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fastexcel" -version = "0.9.0" +version = "0.9.1" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/types/excelsheet.rs b/src/types/excelsheet.rs index 48c8b22..25f3e3f 100644 --- a/src/types/excelsheet.rs +++ b/src/types/excelsheet.rs @@ -188,12 +188,6 @@ fn create_float_array( (offset..limit).map(|row| data.get((row, col)).and_then(|cell| cell.as_f64())), )) } -// match cell { -// CalData::String(s) => Some(s.to_string()), -// CalData::Float(s) => Some(s.to_string()), -// CalData::Int(s) => Some(s.to_string()), -// _ => None, -// })) fn create_string_array( data: &Range
, diff --git a/src/utils/arrow.rs b/src/utils/arrow.rs index 07d8a40..c01dd9b 100644 --- a/src/utils/arrow.rs +++ b/src/utils/arrow.rs @@ -33,7 +33,15 @@ fn get_cell_type( } else if cell.is_bool() { Ok(ArrowDataType::Boolean) } else if cell.is_datetime() { - Ok(ArrowDataType::Timestamp(TimeUnit::Millisecond, None)) + cell.get_datetime() + .ok_or(anyhow!("could not get datetime value from cell: {cell:?}")) + .map(|excel_datetime| { + if excel_datetime.is_datetime() { + ArrowDataType::Timestamp(TimeUnit::Millisecond, None) + } else { + ArrowDataType::Duration(TimeUnit::Millisecond) + } + }) } // These types contain an ISO8601 representation of a date/datetime or a durat else if cell.is_datetime_iso() {