I am reading an excel file that has decimal, string, and Unicode characters when the user uploads it. I am seeing a floating point error when reading some decimal values(not all). For example, if a number is 0.15 then it is read as 0.150000000002. I need to compare data from the same excel file which is read and stored in DB to the data read from excel to find the difference in both. I am using xlxs-js and also tried using exceljs but was not able to resolve the issue.
reader.onload = (e: any) => {
/* read workbook */
const bstr: any = e.target.result;
const wb: XLSX.WorkBook = XLSX.read(bstr, {type: 'buffer'});
/* grab first sheet */
const wsname: string = wb.SheetNames[1];
const ws: XLSX.WorkSheet = wb.Sheets[wsname];
/* save data */
this.data = (XLSX.utils.sheet_to_json(ws, {header: 1}));
console.log(this.data)
};
reader.readAsArrayBuffer(target.files[0]);```