I'm using an npm package called xlsx from this repo:
https://github.com/SheetJS/sheetjs
I am running with the option of cellDates: true but still my output is a number format. Anybody know how to adapt my code to get my date columns parsed as timestamp format or convert the number to a date as a string which also seems to work when I do it manually in the excel file.
Appreciate the help!
const xlsx = require('xlsx')
const excelToObjArr = (filePath) => {
const obj = xlsx.parse(filePath, { 'type': type, cellDates: true }); // parses a file
const data = obj[0].data;
let dataObjects = [];
let tableAttrs = data[0];
for(let i=1; i < data.length; i++){
let newObj = {};
for(let j=0; j < tableAttrs.length; j++){
newObj[tableAttrs[j]] = data[i][j];
}
dataObjects.push(newObj);
}
return dataObjects;
};
module.exports = excelToObjArr;