01-node+xlsx

let xlsx = require('xlsx');
let path = require('path')

// 读取excel
let workbook  = xlsx.readFile(path.join(__dirname, './upload/【粮食基地】 (1).xlsx'));

// 获取所有表名
let sheetNames = workbook .SheetNames

// 根据表名获取对应的表
const worksheet = workbook.Sheets[sheetNames[0]];

// 读取到json对象
let excelObj = xlsx.utils.sheet_to_json(worksheet);
console.log(excelObj)

你可能感兴趣的:(01-node+xlsx)