Google-sheets – Mass-remove empty sheets in Google Spreadsheets

google sheets

I have created an interactive search spreadsheet that filters columns based on the user input and the data from another sheet. Since the user needs to be able to enter values in the search cell, I had to make the spreadsheet editable by anyone, though I locked everything but the required cell and the "chat" sheet.

The problem is that it does not prevent users from creating empty sheets and over the years over two hundreds of those accumulated there. I don't know why it's happening, whether they are created by bots, malicious users or are a byproduct of searching (though they weren't appearing when I was testing).

I'd like to find a way to remove all the empty sheets and, preferably, prevent them from appearing again.

https://docs.google.com/spreadsheets/d/1C4mrBWJxPLrFQ4bp82UA2ICOr1e6ER47wF7YuElyoZg/edit

This is the spreadsheet in question.

Best Answer

Perhaps the simplest solution is to copy the sheet that you want to keep to another to a new spreadsheet. Unfortunately, there is no way to avoid that editors be able to create new sheets but there are several workarounds.

  • Use a third-party app like Awesome Tables or Google Apps Script to create front-end for your spreadsheet.
  • Use the Google Sheets API to create a front-end by using other platforms

If you really need to delete the sheets from your spreadsheet use Google Apps Script or the Google Sheets API

To delete the new sheets automatically after they are created, use the Google Apps Script on change installable trigger

References