How do I hide table columns?

This could be the way how to do it by code…(check it out [attention not tested] !!!)

var myTable = "#table1" //<--- put in here the ID of your table....

$w.onReady(function () {defineTable();});

function defineTable() {
    let myCols = []
    $w(myTable).columns = myCols;

 //creating first COLUMN in the TABLE...
    myCols.push({
       "id": "Col0",                //setting the ID of this column
       "dataPath": "firstColumn",   //setting the column-path(FIELD-ID in DB)
       "label": "First-Column",     //setting the column header/title
       "width": 50,                 //setting the column-width
       "visible": true,             //setting the visibility of this column <-----
       "type": "image"              //defining the type of used column
    });

 //creating second COLUMN in the TABLE...
 
    myCols.push({
       "id": "Col1",                //setting the ID of this column
       "dataPath": "secondColumn",  //setting the column-path(FIELD-ID in DB)
       "label": "Second-Column",    //setting the column header/title
       "width": 50,                 //setting the column-width
       "visible": false,            //setting the visibility of this column <-----
       "type": "number"             //defining the type of used column
    });
    $w(myTable).columns = myCols
}

Creating multiple table-entries…

for (var i = 0; i < DropDowns.length; i++) {
   cols.push({
      "id": "Col" + (i + 1),
      "dataPath": DropDowns[i],
      "label": DropDowns[i],
      "width": 100,
      "visible": true,
      "type": "string"
   });
}