xlsxio icon indicating copy to clipboard operation
xlsxio copied to clipboard

datetime cell recognize as integer value

Open helizhi opened this issue 8 years ago • 9 comments

Dear brechtsanders: when using yours projects, the cell value actually is 2013/3/24, but after transferring into csv file , the value becames an integer value "41357",the project version is xlsxio-0.2.8, are there any solutions?

helizhi avatar Nov 21 '17 02:11 helizhi

Hi, Determining the type, especially with date/time formats has proven to be quite difficult. Can you send me an example file so I can investigate? Regards Brecht

brechtsanders avatar Nov 21 '17 05:11 brechtsanders

Hi: The source file is: test.xlsx After exectuting xlsxio_xlsx2csv, csv file is generated, the content in csv is: id,name,birth,money1,money2 1,helizhi,42986,20.23,120.23 2,zhoumeiling,41357,25.08,125.08

helizhi avatar Nov 21 '17 10:11 helizhi

Dates and times are really stored as (floating point) numbers in Excel. Seeing them as date and time is more like a format thing. That 's why you get numbers when reading the data. However, if you use xlsxioread_sheet_next_cell_datetime() you will get a time_t value, but that's only useful if you know you want to read that cell as a date/time value. Is this of any use to you?

brechtsanders avatar Nov 21 '17 20:11 brechtsanders

How can I know whether it is a date/time value or a string value before using xlsxioread_sheet_next_cell_datetime ?

helizhi avatar Nov 22 '17 03:11 helizhi

Reporting same need here.

damian-m-g avatar Nov 29 '18 22:11 damian-m-g

hopefully has functionality which could detect the type of cell

abcdef123ghi avatar Oct 30 '20 01:10 abcdef123ghi

what information can we get about format?

same problem on this other lib https://github.com/troldal/OpenXLSX/issues/104

gvollant avatar Jan 18 '22 20:01 gvollant

As this issue is opened from a long time ago, I want to add my 2 cents here and suggest a lib I made some time ago for only reading XLSX. You might get rid of this problem using that if you only want to read XLSX. Cheers.

damian-m-g avatar Jan 18 '22 20:01 damian-m-g