科学记数法手机号码 - Excel Javascript

Scientific notation mobile number - Excel Javascript

我正在我的 JS 应用程序中读取 excel 文件。我正在使用 xlsx npm 模块来读取 excel 文件。

但是如果文件中的 MobileNumber = 9.23052E+8 那么我如何将其转换回 javascript 中的普通手机号码?

这是我如何读取文件的示例代码:

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);

我不想告诉用户将单元格格式更改为纯文本或数字。 (抱歉,这是一项要求)。

如有任何帮助,我们将不胜感激。

这段代码解决了我的问题:

Object.keys(sheet).forEach(function(s) {
    if(sheet[s].w) {
        delete sheet[s].w;
        sheet[s].z = '0';
    }
});

有关 的更多信息: