1. 安装

npm install xls-to-json

2. 使用方法

node_xj = require("xls-to-json");
  node_xj({
    input: __dirname +"sample.xls",  // 导入excel的文件路径
    output: __dirname +"output.json", // 输出的json文件路径
    sheet: "sheetname"  // 具体的sheet名 
  }, function(err, result) {
    if(err) {
      console.error(err);
    } else {
      console.log(result);
    }
  });

在配置选项中,必须输入导入的excel路径,如果不想输出任何json文件的话,可以将它设置为null.

3. github地址:

github.com/DataGarage/node-xls-json