1. const exceltojson = require("xlsx-to-json-lc"); //或者xls-to-json-lc,取决于你的文件名。
    2. var excelConfig = {
    3. input: "/Users/abc/Documents/test.xlsx", //要转换的excel文件,如"/Users/chen/matt.xlsx"
    4. output: null, //输出的json文件,不想输出可以写null。如"./yeap.json"
    5. sheet: "sheet1", // 如果有多个表单的话,制定一个表单(excel下面那些标签),可以忽略
    6. lowerCaseHeaders:true //所有英文表头转成大写,可以忽略
    7. }
    8. exceltojson(excelConfig, function(err, excelJson) {
    9. if(err) {
    10. console.error(`转换json报错了:${err}`);
    11. } else {
    12. console.log(`json转换成功:${excelJson}`);
    13. }
    14. });