Closed Gaya3G closed 1 year ago
I have been using XLSX npm (https://www.npmjs.com/package/xlsx) to read excel and csv. I had been having problem with configuring date related params. I initially had code like:
const wb = XLSX.readFile(strFilePath, { type: 'file', cellDates: true, dateNF: 'mm/dd/yyyy' }); const json = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]], { defval: "", raw: false, forceQuotes: true, blankrows: true, });
With this above code, if a date like '12/$8/2022' is entered, it got formatted as '12/08/2022' which was unexpected.
So i changed readFile to:
``` const wb = XLSX.readFile(strFilePath, { type: 'file', raw:true }); ```
With this, when i try to read 9/9/2022, it is read as 9/9/22.
What need to be added to read date as is from excel/csv without formatting?
I have been using XLSX npm (https://www.npmjs.com/package/xlsx) to read excel and csv. I had been having problem with configuring date related params. I initially had code like:
With this above code, if a date like '12/$8/2022' is entered, it got formatted as '12/08/2022' which was unexpected.
So i changed readFile to:
With this, when i try to read 9/9/2022, it is read as 9/9/22.
What need to be added to read date as is from excel/csv without formatting?