Hi - Writing for a friend.. hope it helps someone else.
I was (and am still) mixing up libraries when I found myself banging my head against all examples pointing to npm install node-xlsx and then simply cite xlsx.utils.XYZ, but for me, .utils was not an object. Elsewhere I found this debug snippet:
...
xlsx = require('node-xlsx'),
...
console.log(Object.keys(xlsx)); // not even down to .utils, just main xlsx
Output of this is:
[ 'parse', 'build', 'default' ]
Ah hah. So I was in fact using the wrong npm. Instead of node-xlsx I needed just node install --save xlsx and all works as expected. console.log(Object.keys(xlsx)); gives this and .utils gives that.
This:
[ 'version',
'stream',
'parse_xlscfb',
'parse_ods',
'parse_fods',
'write_ods',
'parse_zip',
'read',
'readFile',
'readFileSync',
'write',
'writeFile',
'writeFileSync',
'writeFileAsync',
'utils',
'SSF',
'CFB' ]
That:
[ 'encode_col',
'encode_row',
'encode_cell',
'encode_range',
'decode_col',
'decode_row',
'split_cell',
'decode_cell',
'decode_range',
'format_cell',
'get_formulae',
'make_csv',
'make_json',
'make_formulae',
'sheet_add_aoa',
'sheet_add_json',
'aoa_to_sheet',
'json_to_sheet',
'table_to_sheet',
'table_to_book',
'sheet_to_csv',
'sheet_to_txt',
'sheet_to_json',
'sheet_to_html',
'sheet_to_dif',
'sheet_to_slk',
'sheet_to_eth',
'sheet_to_formulae',
'sheet_to_row_object_array',
'consts',
'book_new',
'book_append_sheet',
'book_set_sheet_visibility',
'cell_set_number_format',
'cell_set_hyperlink',
'cell_set_internal_link',
'cell_add_comment',
'sheet_set_array_formula' ]
Thanks for listening.
@bronius tell your friend that node-xlsx and xlsx are in fact different projects. It's confusing. Someone else also published js-xlsx on npm so it gets even more confusing.
Ok thanks for validating my observation, psychological framework, and even including a little humor. :D I assure you my friend feels better.
Most helpful comment
@bronius tell your friend that
node-xlsxandxlsxare in fact different projects. It's confusing. Someone else also publishedjs-xlsxon npm so it gets even more confusing.