5

I am trying to call multiple sheets from the excel file ,by implementing single promise statement but it always outputs the data of first sheet. Thank you.

    alasql.promise('select * from xls("raw/food.xls",[{sheetid:"Data"}, {sheetid:"Guideline"}])')
        .then(function (data) {
            console.log(data);
        }).catch(function (err) {
            console.log('Error:', err);
        });

Need to call both sheets data using single promise statement.

rahul.sharma
  • 457
  • 6
  • 20

1 Answers1

2

You need more than one promise, so try this:

alasql.promise(['select * from xls("raw/food.xls",[{sheetid:"Data"}])','select * from xls("raw/food.xls",[{sheetid:"Guideline"}])'])
    .then(function (data) {
        console.log(data);
    }).catch(function (err) {
console.log('Error:', err);
});

Here are some more examples

angel.bonev
  • 2,154
  • 3
  • 20
  • 30