Use node xlsx to write the assembled data into excel and always report errors. The error information is as follows:
(node:6357) UnhandledPromiseRejectionWarning: TypeError: n.indexOf is not a function
at /Users/mac/project/reptile/invoice/node_modules/xlsx/xlsx.js:15693:8
at Array.forEach (<anonymous>)
at check_ws_name (/Users/mac/project/reptile/invoice/node_modules/xlsx/xlsx.js:15692:11)
at /Users/mac/project/reptile/invoice/node_modules/xlsx/xlsx.js:15701:3
at Array.forEach (<anonymous>)
at check_wb_names (/Users/mac/project/reptile/invoice/node_modules/xlsx/xlsx.js:15700:4)
at check_wb (/Users/mac/project/reptile/invoice/node_modules/xlsx/xlsx.js:15713:2)
at Object.writeSync [as write] (/Users/mac/project/reptile/invoice/node_modules/xlsx/xlsx.js:21998:2)
at Object.build (/Users/mac/project/reptile/invoice/node_modules/node-xlsx/lib/index.js:77:33)
at writeXlsx (/Users/mac/project/reptile/invoice/index.js:269:21)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:6357) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:6357) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
There is no useful information in the prompt. You can only use node xlsx to read the normal excel table into JSON, and then compare the normal Josn with the JSON assembled by yourself however, the goose did not find any difference
after careful comparison, the problem is finally found. The reason is that the table name of each table in Excel can only be the string
,
let obj = {
name: more.tatalAmount, // The name obtained here is Number, which must be converted to String with toString()
data: [
[
"111111111"
],
Read More:
- TypeError: r.indexOf is not a function TypeError: r.indexOf is not a function
- [Solved] mqtt.js Error: n.createConnection is not a function
- [Solved] Syntax Error: TypeError: this.getOptions is not a function
- [Solved] Syntax Error: TypeError: this.getOptions is not a function
- [Vue warn]: Error in v-on handler: “TypeError: Object(…) is not a function“
- [Solved] Less Install Error: TypeError: this.getOptions is not a function
- [Web Browser] “Uncaught TypeError: object is not a function“
- [Solved] Echart Error: Typeerror: axis Getaxesonzeroof is not a function
- [Solved] scss Error: TypeError: this.getOptions is not a function
- [Solved] webpack Package Error: TypeError: this.getOptions is not a function style-loader
- [Solved] Module build failed TypeError this.getOptions is not a function at Object.loader
- [Solved] Element form method resetfields() error: vue.runtime.esm.js?2b0e:1888 TypeError: Cannot read properties of undefined (reading ‘indexOf’)
- [Solved] Vue Error: Uncaught TypeError: Vue.createApp is not a function
- [Solved] Element Error: Error in render: TypeError: dateStr.match is not a function“
- [Solved] Vue Route Error: Uncaught TypeError: (0 , vue__WEBPACK_IMPORTED_MODULE_42__.defineComponent) is not a function
- [Solved] Vue Project Error: Syntax Error: TypeError: this.getOptions is not a function
- Vue form validate error: Error in v-on handler “TypeError Cannot read properties of undefined (reading ‘indexOf‘)
- [Solved] Vue3.2 Error: Object.fromEntries is not a function
- [Solved] ESLint:TypeError: this.CliEngine is not a constructor
- [Solved] Failed to load plugin ‘vue‘ declared in ‘.eslintrc.js‘: createRequire is not a function