简体   繁体   English

使用nodejs将excel数据转换为json

[英]excel data to json using nodejs

here i need to convert my excel to json,since i have been in the right path file only.While running it shows a following error: 在这里我需要将我的excel转换为json,因为我只在正确的路径文件中。运行时显示以下错误:

[TypeError: Cannot set property length of [object Object] which has only a getter]Any help? [TypeError:无法设置只有吸气剂的[object Object]的属性长度]有帮助吗?

node_x = require("xls-to-json"); node_x = require(“ xls-to-json”); var stack = new Error().stack; var stack = new Error()。stack;

      try{
     node_x({
      input: "Book1.xls",  // input xls 
      output: "output.json" // output json 

    }, function(err, result) {



          if(err) {

             console.error(err);
                     } else {


    console.log(result);
        }

         }); 

    }catch(e){
         console.log("ssfffs");
         console.error(e);
         }

Try entering the sheet name as well 也尝试输入工作表名称

    node_xj = require("xls-to-json");
  node_xj({
    input: "Book1.xls",  // input xls 
    output: "output.json", // output json 
    sheet: "sheetname"  // specific sheetname 
  }, function(err, result) {
    if(err) {
      console.error(err);
    } else {
      console.log(result);
    }
  });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM