calamine
calamine copied to clipboard
Time is recognized as Float.
time.xlsx is composed of one cell "00:15:00". This cell recognized as Float(0.0104166666666667). I expect as String("00:15:00"). Is this the intended behavior? The test code is below.
#[test]
fn time() {
setup();
let path = format!("{}/tests/time.xlsx", env!("CARGO_MANIFEST_DIR"));
let mut excel: Xlsx<_> = open_workbook(&path).unwrap();
let range = excel.worksheet_range("Sheet1").unwrap().unwrap();
range_eq!(range, [[String("00:15:00".to_string())]]);
}
Yes, internal representations of date and times are float in excel (just type this float value in a cell and force a time format on it). Unfortunately calamine doesn't yest recognize that the number is actually a time and give a corresponding interpreted result.
Oh, internal representations of times are float! Thank you very much. I understood this behavior. Do you have any plans to deal with cell formats in the future?
I'd love to do it but I don't have lot of time to do it properly. I'd accept any PR though 😄
If I can improve it, I'll send PR.
Just fyi, I've added a simple dates
feature to try converting a DataType
into a NaiveDate(Time)
. There is no automatic detection as it is more complicated but hopefully it'll be convenient already.
Thank you very much! This is very helpful. And I'm sorry I couldn't contribute to it.