How to read a list of sheets from a Spreadsheet

If I have a spreadsheet and I load it via the Read Binary File node, is there a way to extract a list of the sheets from the spreadsheet, so that I can loop over them?

Similar question for the Google Spreadsheet node.

Welcome to the community @tylerc

That is sadly not possible. You can make a feature request.

It seems I can allow external modules and get them via:

const { read: xlsxRead } = require('xlsx');

const data = items[0].binary.data;

workbook = xlsxRead(data.data);

return workbook.SheetNames.map((s) => {
  return {
    json: {
      name: s,
    }
  }
});
6 Likes

Hey @tylerc,

Thanks for sharing this! Did it solve your issue completely, or do you need more help? :slight_smile:

ahh, really good idea. Thanks for sharing the solution.

It did solve my issue, though I think I will add a feature request so that a single Spreadsheet Node can output multiple sheets, because adding the loop was also a bit of a pain.

2 Likes