Skip to content

Commit

Permalink
Merge branch 'main' into strings-by-ref-calamine
Browse files Browse the repository at this point in the history
  • Loading branch information
lukapeschke committed Feb 20, 2024
2 parents b9ec9a2 + 1f5221a commit 5026389
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 0 additions & 6 deletions src/types/excelsheet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,6 @@ fn create_float_array<DT: CellType + DataType>(
(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<DT: CellType + DataType>(
data: &Range<DT>,
Expand Down
10 changes: 9 additions & 1 deletion src/utils/arrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@ fn get_cell_type<DT: CellType + Debug + DataType>(
} 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() {
Expand Down

0 comments on commit 5026389

Please sign in to comment.