npm 模块笔记(二):xls-to-json

来源:互联网 发布:java httpclient 详解 编辑:程序博客网 时间:2024/06/06 10:01

node-xls-json

使用 nodejsxls 转为 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

以上,来自npm:https://www.npmjs.com/package/xls-to-json。

0 0