I am trying to read data form xlsx file and converting it into json, but the date column value is changing Here is the screenshot:Screenshot of my excel file from which i am reading data
Here is the code for reading data from excel file and converting into JSON:
onBasicUpload(event){
let workBook = null;
let jsonData = null;
const reader = new FileReader();
const file = event.files[0];
console.log(file,"file is here");
reader.onload = (event) => {
const data = reader.result;
workBook = xlsx.read(data, { type: 'binary' });
jsonData = workBook.SheetNames.reduce((initial, name) => {
const sheet = workBook.Sheets[name];
initial[name] = xlsx.utils.sheet_to_json(sheet);
console.log(jsonData,"jsonDAta");
return initial;
}, {});
const dataString = JSON.stringify(jsonData);
console.log(dataString,"stringify data");
this.jsonArr = JSON.parse(dataString)
console.log(this.jsonArr,"parsed json");
console.log(Object.keys(this.jsonArr['data'][0]))
}
reader.readAsBinaryString(file);
}
It is returning me this: DOCDT is the value of the date being returned. {"data":[{"DOCNO":"001","NETAMOUNT":30000,"IREF1":"50","IREF2":"100","DOCDT":43989},{"DOCNO":2,"NETAMOUNT":40000,"IREF1":40,"IREF2":90,"DOCDT":43989}]}