Search code examples
google-apps-scriptgoogle-sheetsgs-installable-triggers

How to use onChange event to detect deleted rows with a Google Sheets Apps Script


onChange event has the "REMOVED_ROW" type for a SpreadsheetTriggerBuilder

However, nowhere in the documentation do I see a way to see which row(s) was removed from the event. Is there a way to get the row number(s) that were deleted with this event?


Solution

  • You can use getActiveRange(). When a user removes a row it will automatically select the row that is below the deleted row.