dtjohnson / xlsx-populate

Excel XLSX parser/generator written in JavaScript with Node.js and browser support, jQuery/d3-style method chaining, encryption, and a focus on keeping existing workbook features and styles in tact.
MIT License
956 stars 183 forks source link

Getting all used cells in a specified column #287

Open ecardm opened 4 years ago

ecardm commented 4 years ago

Upon reading the documentation it seems there is no .count() for columns, how can I get an array of the value of all used cells? This is what I come up with but if column C outnumbers column B there will be empty cell values. Please shed some light for me, thank you.

const urls = XlsxPopulate.fromFileAsync("./test.xlsx").then(workbook => {
  const sheet = workbook.sheet("Sheet1");
  const lastCell = sheet.usedRange().endCell().rowNumber();
  return sheet.range(`B1:B${lastCell}`).value();
});