Open MajorShaan opened 3 years ago
I also got this same error. The problem was that when calling 'convert' directly in this manner, 'this' is undefined because the require returns a class instance.
I was able to make it work like this:
const converter = require('xlsx-converter');
converter.convert( "filename.xlsx", { to: 'csv' }, ).then( result => { console.log(result); });
a normal project just copied the readme example code
`const {convert} = require('xlsx-converter');
convert('id pass all core.xlsx').then(result => { // do something with the result console.log(result); });`
and got this error
this.options = opts || {}; ^
TypeError: Cannot set property 'options' of undefined at convert (C:\Users\Shaan\Documents\code\arrange\node_modules\xlsx-converter\index.js:84:18) at Object. (C:\Users\Shaan\Documents\code\arrange\convert.js:3:1)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47