# Trigger script onEdit event from App

**URL:** <https://community.glideapps.com/t/trigger-script-onedit-event-from-app/6795>\
**Category:** Ask for Help\
**Created:** [April 11, 2020, 1:26pm UTC](https://community.glideapps.com/t/trigger-script-onedit-event-from-app/6795 "2020-04-11T13:26:13Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![Carlos\_DeSilva](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/carlos_desilva/32/19965_2.png) [@Carlos\_DeSilva](https://community.glideapps.com/u/Carlos_DeSilva)\
**Post date:** [April 24, 2020, 4:11pm UTC](https://community.glideapps.com/t/trigger-script-onedit-event-from-app/6795/11 "2020-04-24T16:11:58Z")

</div>

function trailerDelete(e) { //This is the onChange(e) trigger  
var app = SpreadsheetApp;  
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();

var targetSheet = app.getActiveSpreadsheet().getSheetByName(“Report”);  
// You can replace “Report” in the above line, to the sheet that you are referencing.

[//Logger.log](https://Logger.log)(targetSheet.getRange(2, 2).getValue() + " Test");  
if (e.changeType==“EDIT”){  
for (var i = 2; i \< 6;i++){  
if (targetSheet.getRange(i,2).getValue() ==""){  
targetSheet.getRange(i, 3).clear();  
targetSheet.getRange(i, 4).clear();  
targetSheet.getRange(i, 5).clear();  
// The 3 examples above are the columns and corresponding row that need to be //deleted  
}  
}  
}  
}

The example above is what I use to clear a set of values when I check to see if a cell is empty. It iterates through my entire sheet.

I must tell you that the script can take time to run depending on the size of your sheet and how much data you are trying to edit. Also, there is the Glide/Google lag if your account is not pro.

---

_[View the full topic](https://community.glideapps.com/t/trigger-script-onedit-event-from-app/6795)._
