user2062741
user2062741

Reputation: 11

deleteActiveSheet not found in object Sheet

I want delete one sheet in my spreadsheet.

my code is:

  var go = workSheet.getSheetByName("Mail");

  go.deleteActiveSheet();

I receive an error message, and I don't understand what's wrong.

deleteActiveSheet not found in object Sheet

What's wrong?

Upvotes: 1

Views: 177

Answers (1)

Phil Bozak
Phil Bozak

Reputation: 2822

You need to call deleteActiveSheet() on the Spreadsheet (see the documentation).

So your code should look something like this.

var sheet = worksheet.getSheetByName("Mail");
worksheet.setActiveSheet(sheet);
worksheet.deleteActiveSheet();

Upvotes: 3

Related Questions