I've got this code going on:
function deleteSheets(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheets = ss.getSheets();
var transp = ss.getSheetByName("aux").getRange("A2:A").getValues();
var i =0;
var c = 0;
var name;
for(i in sheets){
for(c in transp){
var nome_transp = transp[c][0];
switch(name = sheets[i].getName()){
case name == transp[c]:
ss.deleteSheet(sheets[i]);
break;
case name == "aux":
ss.deleteSheet(sheets[i]);
break;
case name == "nulos":
ss.deleteSheet(sheets[i]);
break;
case name == "Sem Transportadora":
ss.deleteSheet(sheets[i]);
break;
}
}
}
}
I can see through the debbuging that the counters and the values in "sheets" and "transp" are correct, but they never delete their respectives sheets, neither does the "aux", "nulos", and "Sem transportadora" ones. And yes, the sheets got the same name as the arrays.
Any insights? Thanks in advance!