I am reading excel file in my JS App. I am using xlsx npm module to read excel file.
But if MobileNumber
in file = 9.23052E+8
then how can i convert it back into plain mobile number in javascript?
Here is example code of how i am reading file:
const bstr = evt.target.result;
const wb = XLSX.read(bstr, {type:'binary'});
const wsname = wb.SheetNames[0];
const ws = wb.Sheets[wsname];
const data = XLSX.utils.sheet_to_csv(ws, {header:1});
console.log("Data>>>"+data);
I don't want to tell user to change format of your cells to plain text or numbers. (Sorry but that is a requirement).
Any help would be appreciated.
This code resolved my issue:
Object.keys(sheet).forEach(function(s) {
if(sheet[s].w) {
delete sheet[s].w;
sheet[s].z = '0';
}
});