I am trying to create a trigger that sends emails when lines are appended or inserted to a sheet. The problem I have is that the python script that is connected to the google sheet purges sheet "new_strikes" then inserts new information in the same Google sheet. I have a onChange trigger like so:
function trigFunc(e){
var activeSheet = e.source.getActiveSheet();
if(activeSheet.getName() != 'new_strikes') return;
Utilities.sleep(30);
sendEmail();
}
The problem is when I purge then insert data into this sheet, the script runs twice--once for the purge and once for the edit. Since the trigger sends an email, I get two emails. How do I modify the code or trigger so that it only tracks the insertion of data and therefore sends one email?