-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Description
Currently using community version xlsx-0.18.11
, I can generate my data as .xlsx, but when I tried to change to .xlsb I got the following error:
RangeError [ERR_INVALID_OPT_VALUE]: The value "NaN" is invalid for option "size"
at Function.alloc (buffer.js:370:3)
at new_raw_buf (/var/www/my-project/node_modules/xlsx/xlsx.js:175:43)
at new_buf (/var/www/my-project/node_modules/xlsx/xlsx.js:4067:10)
at write_BrtShortSt (/var/www/my-project/node_modules/xlsx/xlsx.js:16071:20)
at write_ws_bin_cell (/var/www/my-project/node_modules/xlsx/xlsx.js:16631:61)
at write_CELLTABLE (/var/www/my-project/node_modules/xlsx/xlsx.js:16679:16)
at write_ws_bin (/var/www/my-project/node_modules/xlsx/xlsx.js:16795:2)
at write_zip_xlsb (/var/www/my-projecty/node_modules/xlsx/xlsx.js:24825:25)
at write_zip (/var/www/my-project/node_modules/xlsx/xlsx.js:25190:23)
at write_zip_type (/var/www/my-project/node_modules/xlsx/xlsx.js:25197:10)
at writeSync (/var/www/my-project/node_modules/xlsx/xlsx.js:25335:22)
at Object.writeFile [as writeFileSync] (/var/www/my-project/node_modules/xlsx/xlsx.js:25358:9)
I had to dig a bit, but here is what I noticed:
- When using
XLSX.utils.sheet_add_aoa
, the content of the aoa cells are directly put in the sheet cells'v
value property (unless object, which is merged) - As a consequence, some cells had pure integer or boolean values instead of string.
- Boolean value is ok (when opening the excel it shows up as 'true' but I'm not sure if it was converted to string or just Excel UI displaying this). My test cell:
{ "v": true, "t": "s", "z": "@" }
- Number value causes the error:
{ "v": 123456, "t": "s", "z": "@" }
(I kept my custom formatting in the examples in case this is relevant, but I don't believe it should be)
No problem when generating a regular .xlsx though. I also did not test on other formats than .xlsx and .xlsb. Or with non-integer numbers.
Metadata
Metadata
Assignees
Labels
No labels