javascript-如何使用nodejs从excel读取A列的值?
作者:互联网
如何使用nodejs(node-xlsx)从excel只读取Column A的值?请指教.读取所有列值之后,然后循环搜索其他来源.
var xlsx = require('node-xlsx');
var obj = xlsx.parse(__dirname + '/test.xlsx');
var obj = xlsx.parse(fs.readFileSync(__dirname + '/test.xlsx'));
console.log(JSON.stringify(obj));
解决方法:
尝试其他名为nlsx的npm软件包:
'use strict';
const _ = require('lodash');
const xlsx = require('xlsx');
const workbook = xlsx.readFile('./data/pv.xlsx');
const worksheet = workbook.Sheets[workbook.SheetNames[0]];
const columnA = [];
for (let z in worksheet) {
if(z.toString()[0] === 'A'){
columnA.push(worksheet[z].v);
}
}
console.log(columnA);
标签:node-js,javascript,node-modules 来源: https://codeday.me/bug/20191026/1937102.html