user2848031 user2848031 - 1 year ago 122
Javascript Question

How to read only column A value from excel using nodejs?

How to read only Column A value from excel using nodejs(node-xlsx) ? Please advise. After reading all the column values then loop through to search from other source.

var xlsx = require('node-xlsx');
var obj = xlsx.parse(__dirname + '/test.xlsx');
var obj = xlsx.parse(fs.readFileSync(__dirname + '/test.xlsx'));

Answer Source

Try other npm package called: xlsx:

'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'){

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download