sheetjs
sheetjs copied to clipboard
SSF - format not supported
I have been using SSF in my project, and have run into this problem - when the format is "#,0" it seems to throw an error. That is a valid excel format.
Error: unsupported format |#,0| Component: write_num_flt Stack: at write_num_flt (ssf.js:498) at write_num (ssf.js:616) at eval_fmt (ssf.js:824) at format (ssf.js:940)
Excel appears to be auto-correcting #,0
to #,##0
. You can create a new file with
var wb = XLSX.utils.book_new();
var ws = XLSX.utils.aoa_to_sheet([[12345.6789]]);
ws["A1"].z = "#,0";
XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
XLSX.writeFile(wb, "issue2695.xlsx");
(https://jsfiddle.net/c91Lotas/ live example) Excel 2019 en-US appears to treat it as number with thousands separator and zero decimal places
I can see that, but is the library going to support that?
It's an interesting question. The current approach is to stick the autocorrected formats in the main file processing library, but it probably should be added to the library.
could you refer me to the code relating to this?