我正在使用xlsx包。如果有的话,请推荐任何其他套餐
我试过了,但我没有得到完整的数据
52 apple, one and teen, 682
答案 0 :(得分:1)
你可以使用
npm install excel
使用它。
var parseXlsx = require('excel');
parseXlsx('Spreadsheet.xlsx', function(err, data) {
if(err) throw err;
// data is an array of arrays
});
您还可以访问Converting excel file to json in nodejs
Note: Make sure your Excel file is not opened by any other software (especially Excel !).
快乐的编码。
答案 1 :(得分:0)
var XLSX = require('xlsx');
var workbook = XLSX.readFile('Test1.xlsx');
var first_sheet_name = workbook.SheetNames[0];
// to read the value of individual cell
var address_of_cell = 'C4';
var worksheet = workbook.Sheets[first_sheet_name];
var desired_cell = worksheet[address_of_cell];
var desired_value = (desired_cell ? desired_cell.v : undefined);
console.log(desired_value);
有关进一步说明,请阅读xlsx https://www.npmjs.com/package/xlsx
的文档答案 2 :(得分:0)
var XLSX = require('xlsx');
var workbook = XLSX.readFile(path);
var sheet_name_list = workbook.SheetNames;
var xlData = XLSX.utils.sheet_to_json(workbook.Sheets[sheet_name_list[0]]);
for (let i = 0; i < xlData.length; i++) {
let employee_choice1 = xlData[i].employee_choice
var employee_choice = employee_choice1.split(',')
//implement your condition
}