sheetjs icon indicating copy to clipboard operation
sheetjs copied to clipboard

Date not preserved from CSV to XLSX

Open LouisDelbosc opened this issue 2 years ago • 1 comments

I'm reading some csv data and try to convert it to XLSX. I have a datetime column and it seems the data is not preserved correctly between CSV and XLSX.

I joined some screenshot opened with numebrs and google spread sheet. It is a known issue ? If I use excel will the data be preserved (having a datetime and not a date or just a number) ? Or maybe I did miss an option ? ( I added cellDates: true on reading and writing) ?

Screenshot 2022-07-13 at 11 33 09

CSV

Screenshot 2022-07-13 at 11 33 20

XLSX

Screenshot 2022-07-13 at 11 34 51

import on google spreadsheet

LouisDelbosc avatar Jul 13 '22 09:07 LouisDelbosc

I found similar and ended up (rightly or wrongly) using this function/library to do the conversion

import { getJsDateFromExcel } from 'excel-date-to-js

rcoundon avatar Jul 13 '22 09:07 rcoundon