How to use onChange event to detect deleted sheet

2019-09-02 01:04发布

问题:

onChange event has the "REMOVED_ROW" type for a SpreadsheetTriggerBuilder

However, nowhere in the documentation do I see a way to see which sheet was removed from the event. Is there a way to get the deleted sheet with this event?

回答1:

The change event for most of the change types doesn't include a property that could be used to identify the inserted, removed sheets among other changes. In order to identify which sheet was affected we have to keep a list of spreadsheet sheets to compare with the current sheets collection. For that we could use the Properties service that could be safer than use a sheet as it could be deleted too.