Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

158
Views
Removing numbered columns using alaSql

I'm trying to do an xlsx export using alasql, everything works perfectly except my columns are numbered for some reason, and I can't seem to find those numbers in any of the arrays I'm using.

This is my current code:

var myTableArray1 = [];
        $("table#tableMain1 tr").each(function () {
            var arrayOfThisRow = [];
            var tableData = $(this).find('td');
            if (tableData.length > 0) {
                tableData.each(function () { arrayOfThisRow.push($(this).text()); });
                myTableArray1.push(arrayOfThisRow);
                
            }
        });
        
        console.log(myTableArray1);


        var myTableArray2 = [];
        $("table#tableMain2 tr").each(function () {
            var arrayOfThisRow = [];
            var tableData = $(this).find('td');
            if (tableData.length > 0) {
                tableData.each(function () { arrayOfThisRow.push($(this).text()); });
                myTableArray2.push(arrayOfThisRow);
                
            }
        });
        
        console.log(myTableArray2);

        

        window.saveFile = function saveFile() {
            var data1 = [];
            var data2 = [];

            myTableArray1.forEach((n, i) => { data1.push(n) });
            myTableArray2.forEach((n, i) => { data2.push(n) });
            console.log(data1);
            console.log(data2);

            var opts = [{ sheetid: 'ONE', header: true }, { sheetid: 'TWO', header: false }]

            var res = alasql('SELECT INTO XLSX("(@Model.Account).xlsx",?) FROM ?', [opts, [data1, data2]]);

What I have in the xlsx looks like this: xlsx formatting

What I have tried:

data1.shift(); //removes actual column names on data1 
data2.shift(); //removes actual column names on data2

myTableArray1.shift(); //same outcome as above
myTableArray2.shift(); //same outcome as above

var opts = [{ sheetid: 'ONE', header: true, range:"A2:Z" }, { sheetid: 'TWO', header: false, range:"A2:Z" }] //moves everything down by one row
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!