4

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.

1
6
  • 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]);}}}

0

Use Bulk Sheet Manager. It also allows you to hide sheets, which may be useful if sheets have some dependency.

0

Created a macro, this deletes the first 10 sheets, modify as you need.

function DeleteSheet() {
  var spreadsheet = SpreadsheetApp.getActive();
  for (i = 0; i < 10; i++) {
  spreadsheet.deleteActiveSheet();}
};

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