diff --git a/xlsxspread.js b/xlsxspread.js index ac6e910..d4b88f9 100644 --- a/xlsxspread.js +++ b/xlsxspread.js @@ -15,6 +15,7 @@ function stox(wb) { wb.SheetNames.forEach(function (name) { var o = { name: name, rows: {} }; var ws = wb.Sheets[name]; + if(!ws || !ws["!ref"]) return; var range = XLSX.utils.decode_range(ws['!ref']); // sheet_to_json will lost empty row and col at begin as default range.s = { r: 0, c: 0 }; @@ -91,8 +92,8 @@ function xtos(sdata) { if (!cellText) { cellText = ""; type = "z"; - } else if (!isNaN(parseFloat(cellText))) { - cellText = parseFloat(cellText); + } else if (!isNaN(Number(cellText))) { + cellText = Number(cellText); type = "n"; } else if (cellText.toLowerCase() === "true" || cellText.toLowerCase() === "false") { cellText = Boolean(cellText);