Alasql - Utilizing multiple sheetids in a single promise declaration

I've been attempting to retrieve data from multiple sheets in an Excel file using a single promise statement, but I keep getting the data only from the first sheet. Any help is appreciated. 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);
        });

Is there a way to fetch data from both sheets using just one promise statement?

Answer №1

For optimal results, it is recommended to utilize more than one promise. Here is an example:

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);
});

For additional examples, check out this link.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The HTML status code is 200, even though the JQuery ajax request shows a status code of 0

My issue is not related to cross site request problem, which is a common suggestion in search results for similar questions. When attempting to make an ajax request using jquery functions .get and .load, I'm receiving xhr.status 0 and xhr.statusText ...

Fixing the Timeout Error in Node.js & Mongoose: A Step-by-Step Guide

After developing an API, I encountered the following issue: const express = require("express"); const router = express.Router(); const {getAttendanceSheet,getDailyAttendance} = require("../../services/attendanceService"); router.get(& ...

Ways to enhance a Vue component using slots

I am looking to enhance a third-party library component by adding an extra element and using it in the same way as before. For example: <third-party foo="bar" john="doe" propsFromOriginalLibrary="prop"> <template v ...

Utilize a Sails.js Single Page Application (SPA) to route all unutilized paths to a centralized controller function

I'm currently working on a project where I am building a single page application (SPA) with Sails.js as the backend. My goal is to have all routes redirect to a single controller action. However, the issue I am facing is that when I try the following ...

What is preventing me from accessing these attributes using "${array[a].name}"?

What is preventing me from reading the properties using ${ array[a].name } with For Of loop? I created an example with an array of objects to help diagnose the problem. const movies = [{ title: "Shrek", year: 2001 }, { title: "Shrek 2", ...

Determine the initial left position of a div element in CSS prior to applying

Scenario : const display = document.querySelector('.display'); const container = document.querySelector('.outer-div'); document.addEventListener("click", (event) => { if (!event.target.closest("button")) return; if(event ...

Is the OR (||) operator malfunctioning in the Angular.forEach method?

I am faced with the challenge of manipulating a JSON array by applying certain conditions for removal: var data = [ {data1: "aaa", data2: "bbb", data3: "ccc"}, // First {data1: "ddd", data2: "eee", data3: "fff"}, // Second ...

The feature of window.open and pop-up blocker integrated into the $.ajax().done() function is

When my jQuery ajax call is completed, I need to open a URL in a new tab. Here's the function I created for this purpose: var openNewTab = function() { window.open('/UrlToOpen', '_blank'); win.focus(); } If I directly cal ...

What is the best way to increase a JavaScript date by 1 UTC day?

Is there a way to use javascript to take a non-UTC date, add 1 UTC day to it, reset the time to zero, and then convert it to an ISO string? new Date().toISOString() 2017-10-10T16:00:49.915Z Required UTC Datestring 2017-10-11T00:00:00.000Z ...

The div functions seem to stop working properly after they have been multiplied

Initially, I use JavaScript to multiply the div but then encounter issues with the function not working properly. function setDoorCount(count) { $('.doors').html(''); for (var i = 0; i < count; i++) { var content = " ...

Steps for removing routing in Angular 2 after setting the folder as a dependency for another project

In my testing Angular project (referred to as project1), I am developing components and utilizing routing for organizational and aesthetic purposes. There is another Angular project (referred to as project2) which includes the component project-project1 i ...

Integrating various object properties in Angular's select ng-options: A comprehensive guide

I need to merge text and number properties from JSON to display as select options values by default. The expected output should be: 000.000.0001 - Chicago HTML: <!doctype html> <html ng-app="plunker" > <head> <meta charset="utf-8"& ...

Determine the output based on the data received from the ajax post request

I am seeking a way to validate my form based on the data returned. Currently, the validation only returns false if the entire post function is false. Is there a solution to differentiate how it is returned depending on which condition is met? This is my ...

Navigating through the Express.js routes incorrectly

I currently have 3 different express.js routes set up: app.get('/packages/:name', (req, res) => {...}); app.get('/packages/search/', (req, res) => {...}); app.get('/packages/search/:name', (req, res) => {...}); At t ...

Exceeding the boundaries: Bootstrap 4 Tooltip escaping the div

When hovering over an anchor tag with tooltip attributes, the tooltip appears far away from the anchor tag. Here is the LINK - Even when inspecting element it seems to be positioned too far away. <a class="btn btn-secondary" data-toggle="tooltip" dat ...

Utilizing Jquery to auto-scroll when an element reaches the top of

I have arrows positioned at the end of sections on my website that I want users to be able to click on in order to scroll to the next section. The issue I am facing is that while the first click works, subsequent clicks do not result in scrolling even thou ...

Turn off hover effect for the v-checkbox component in Vuetify 2

Is there a way to prevent the darkened circle from appearing behind a v-checkbox in Vuetify 2 when hovering over it? My v-checkbox is currently enclosed within a v-tab and a v-tooltip, although I'm not sure if that has any impact. <v-tab v-for=&quo ...

Using Jquery to sequentially add a class to individual <li> elements in a list, with a delay of 5 seconds for each addition

Currently, I am working on a website that requires me to assign a class of 'active' to a series of <li> elements. The number of <li> elements varies - sometimes there are six, other times 17. This needs to be adaptable and dynamic. ...

jQuery AJAX encountering parsing error when retrieving data from Laravel controller

I'm attempting to retrieve data from a laravel controller using 'jquery' ajax, but I keep encountering the 'parsererror'. According to the laravel documentation, it automatically sets the header Content-Type= 'application/json ...

Unable to accurately render selected item from drop-down menu

I am facing an issue with my component that contains a select menu. When I change the value in the select menu, I get the selected value. However, when I click the button to get both values from the two select menus, I see that the value appears as [object ...