Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alasql -Multiple sheetids within single promise statement

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.

like image 699
rahul.sharma Avatar asked Oct 28 '22 17:10

rahul.sharma


1 Answers

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

like image 127
angel.bonev Avatar answered Nov 11 '22 09:11

angel.bonev