2

In a Google Sheets spreadsheet (Excel terminology = workbook) is it possible to delete multiple tabs (Excel terminology = worksheet) in one go without having to right click each one and delete it.

3
  • this deletes all sheets except Sheet1, Sheet2 and Sheet3

function DELETESHEETS() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheets = ss.getSheets();
  for (i = 0; i < sheets.length; i++) {
     switch(sheets[i].getSheetName()) {
     case "Sheet1":
     case "Sheet2":
     case "Sheet3":
     break;
     default:
     ss.deleteSheet(sheets[i]);}}}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.