站内搜索:
首页 >> 前端 >> 内容
npm模块(二)xls-to-json

时间:2017/4/20 10:43:00

npm模块(二)xls-to-json:使用 nodejs 将 xls 转为 json。

安装

npm install xls-to-json

使用

node_xj = require("xls-to-json");
node_xj({
  input: "sample.xls",  // 输入 xls 
  output: "output.json", // 输出json 
  sheet: "sheetname"  // 特殊 Excel 表名 
}, function(err, result) {
  if(err) {
    console.error(err);
  } else {
    console.log(result);
  }
});

在配置对象时,输入参数是必填的,但是如果不需要任何输出,可以将output 参数设置为 null。

  • 上一篇:JS跨时区时间解决方案
  • 下一篇:vue安装详情
  • 返回顶部