2 years ago
#69314
user202
SheetJs converting string with date automatically to date angular
I am importing a CSV file in my angular application using sheetjs, Data is imported successfully. but it is converting string with a date to only date ignoring the string.
Code in ts file
readExcel() {
let readFile = new FileReader();
readFile.onload = (e) => {
this.storeData = readFile.result;
var data = new Uint8Array(this.storeData);
var arr = new Array();
for (var i = 0; i != data.length; ++i) arr[i] = String.fromCharCode(data[i]);
var bstr = arr.join("");
var workbook = XLSX.read(bstr, { type: "binary" });
var first_sheet_name = workbook.SheetNames[0];
this.worksheet = workbook.Sheets[first_sheet_name];
let processJsonData: Array<any> = XLSX.utils.sheet_to_json(this.worksheet, { raw: false });
console.log(processJsonData)
}
}
How to get both string and date in the json response. Please suggest
node.js
angular
typescript
xlsx
sheetjs
0 Answers
Your Answer