核心提示:npm模块(二)xls-to-json:使用 nodejs 将 xls 转为 json。安装npm install xls-to-json使用node_xj = require(xls-to-json...
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。


