calamine icon indicating copy to clipboard operation
calamine copied to clipboard

Expose typed data for dates and times

Open jrmuizel opened this issue 9 years ago • 10 comments

Currently they're just strings it would be nice if we could add support for exposing the type of these cells.

jrmuizel avatar Jul 25 '17 20:07 jrmuizel

Yes you're right. I have to dig into the documentation to parse this properly but I do not have much time at the moment, perhaps you'd like to give it a try?

tafia avatar Jul 26 '17 11:07 tafia

@tafia I am getting float value when trying to parse date-typed cell.

I have included the example xlsx: book.xlsx

yivo avatar Oct 06 '17 13:10 yivo

@tafia the functions below (from xlsx-js) might be useful, maybe just implement that in rust?

I can give it a try if you don't mind 😜

dmk avatar Oct 09 '17 10:10 dmk

Thanks! I'm a little busy at the moment, I'll try to make it as fast as possible. Feel free to make a PR!

tafia avatar Oct 09 '17 10:10 tafia

I can give it a try if you don't mind 😜

I am starting to look at it but this is far from trivial. I really don't mind if you look at it 😄 .

Instead of having a calamine::DateTime struct, I'd prefer, if possible having some existing item:

  • either std::time::Instant
  • or chrono::DateTime (not sure if it is overkill or not)?

What do you think?

tafia avatar Oct 10 '17 08:10 tafia

I'd prefer unix timestamp (u64), cause it can be used in any time/date lib (e.g. chrono).

dmk avatar Oct 10 '17 10:10 dmk

Looks good to me too!

tafia avatar Oct 10 '17 10:10 tafia

Hi, Has anyone worked on this ticket? If not completely, can you share what you've figured out so far? I mean what exactly needs to be done to be able to parse date/time columns?

base58ed avatar Feb 25 '18 06:02 base58ed

I had a look and having a perfect solution is not simple. Basically we need to parse the text format and decide upon it.

You can always have a look at https://github.com/SheetJS/js-xlsx implementation. It is not easy to read and I am not sure there is a one fits all solution (xlsb and xlsx will likely be different).

tafia avatar Mar 01 '18 08:03 tafia

Is there anything left to do before this issue can be closed?

robyoung avatar Oct 06 '20 08:10 robyoung