Notifiy Me when Row Deleted in Google Sheets

Learn how to set up an email notification in Google Sheets that alerts you when a row is deleted, using Google Apps Script and triggers.

Here's how to set up an email when a row is deleted in our sheet. So we want to know if someone actually goes and deletes a row, how do we do that? We're going to go to extensions app script . We're going to ultimately need two things. We're gonna need a function and the trigger to trigger that function . So we're going to say, email me, and we're going to use E here as an event. This E is a variable that's going to gather interesting information when there's a change to the Google sheet. One of those things we're going to be able to see is the type of change. E dot change type. And if type is equal to remove row, all caps with a underscore here, then we're going to email ourselves. I'm going to go gmail app dot send email. Who it's to will be. I'm just going to go variable owner equals spreadsheet app dot get active Can I get alerted when a tab name is changed? Simply Email Yourself From a Google Sheet Automated Project Management in Google Sheets Email When Cell Changes

spreadsheet get owner get email. That's just my own email now or your own email. This is the owner of the sheet. We're going to email the owner . We're going to say, hey, something's deleted. And in the body, we're going to have some information. We're going to say. Variable row equals spreadsheet app dot get active range , get row. Variable row count equals spreadsheet app dot get active range , dot get num rows. So these two things combined will give us which row we're on, how many rows we're actually selected and deleted, if we're removing row. And here we can put together. Hey, plus row count, Weekly Email Sheet as Lead Magnet Simply Email Yourself From a Google Sheet Email When Cell Changes

deleted row count, then slash n for a new line, row plus row. So this email will tell us which row has been deleted and how many. So as if it's one row, it'll be one. If it's on row 12, it'll be 12. So let's save this. Now, let's do the last thing we need to do, which is create the trigger for this email me. Go over to Triggers, Add Trigger . Be very simple. Choose which function to run from spreadsheet on change. Select that event type. Click Save. Once we save, we're going to have to authorize this. Now our trigger is here. If you don't want this trigger anymore, go to the three dots over here and click delete trigger . Let's go back to our sheet and let's delete the 12th row. Dylan Asks: How to Automatically Delete Rows If Cell Contains Value Automate Row Deletion in Google Sheets with Apps Script Dylan Asks: How to Automatically Delete Rows If Cell Contains Value How To Insert Row Under Header Automatically

Delete row . You can see in our executions it is completed. And we check our email and it says, hey, something's deleted. Hey, deleted row, count one, row 12. Really cool. Let's go and delete row 12. More rows, four rows, delete row seven to ten. Hey, something's been deleted, four rows, starting row seven. Very cool. If we want to add the URL of the sheet, we could go here, plus slash n, plus URL, get the variable URL, equals. SpreadsheetApp . getActiveSpreadsheet. getUrl. Save that. Let's go ahead and delete another row. Another three rows. Delete rows. And here, something's been deleted. We have the row count three, row nine, and the sheet that we can go check. Dylan Asks: How to Automatically Delete Rows If Cell Contains Value Automate Row Deletion in Google Sheets with Apps Script Dylan Asks: How to Automatically Delete Rows If Cell Contains Value How to Delete Rows in Google Sheets

Maybe we want to go check and see what did they delete. I don't know. Hope you enjoyed that video. If you're trying to add more automations, stick around here to better sheets on YouTube, subscribe really helps. Better Sheets Videos Checklist Automation is not Magic