# Help With Deleting a Row with a Certain Cell Value

**URL:** <https://community.glideapps.com/t/help-with-deleting-a-row-with-a-certain-cell-value/13106>\
**Category:** Ask for Help\
**Created:** [July 26, 2020, 2:20am UTC](https://community.glideapps.com/t/help-with-deleting-a-row-with-a-certain-cell-value/13106 "2020-07-26T02:20:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paris\_Smith](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/paris_smith/32/10164_2.png) [@Paris\_Smith](https://community.glideapps.com/u/Paris_Smith)\
**Post date:** [July 26, 2020, 2:20am UTC](https://community.glideapps.com/t/help-with-deleting-a-row-with-a-certain-cell-value/13106/1 "2020-07-26T02:20:59Z")

</div>

Hi,

I am playing around with scripts with the intent to delete a row on my sheet with a user action (click a toggle making a cell go from False to True). Can anyone assist? Thanks in advance for any help!!

Also, I’m curious if my app trigger is right (or if I need one…).

Here’s what I have so far:  
(Found this script on the web and edited it for my sheet.)  
function onChange(e) {  
var s = event.source.getActiveSheet();  
var r = event.source.getActiveRange();

//change “main” to the tab sheet name you are using  
// getColumn with “Delivered” is currently set to column 4 or D. Change to  
//column you are using.

if(s.getName() == “Favorites” && r.getColumn() == 4 && r.getValue() == “TRUE”) {  
var row = r.getRow();  
s.deleteRow(row);  
}  
}

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [July 26, 2020, 2:49am UTC](https://community.glideapps.com/t/help-with-deleting-a-row-with-a-certain-cell-value/13106/2 "2020-07-26T02:49:48Z")

</div>

You should not name the function “onChange”, let’s call that “DeleteRows”.

The “TRUE” can be perceived the wrong way, I have always used True without the double quotes for conditions.

Otherwise it should be fine and you can go to Edit \> Current project’s triggers \> Add a trigger for the function, set the event type to On change.

---

<div class="post-metadata">

**Author:** ![Paris\_Smith](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/paris_smith/32/10164_2.png) [@Paris\_Smith](https://community.glideapps.com/u/Paris_Smith)\
**Post date:** [July 26, 2020, 3:50am UTC](https://community.glideapps.com/t/help-with-deleting-a-row-with-a-certain-cell-value/13106/3 "2020-07-26T03:50:08Z")

</div>

@ThinhDinh, hmmm. Still not sure why it’s not working - but I made the changes you suggested. I’m still fiddling around with it. I figured this would be really simple. These scripts seem to always take me so long to get just right. Let me know if you have any other thoughts… 🤔

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [July 27, 2020, 2:48am UTC](https://community.glideapps.com/t/help-with-deleting-a-row-with-a-certain-cell-value/13106/4 "2020-07-27T02:48:38Z")

</div>

Can you send a duplicate sheet to [ariesarsenal@gmail.com](mailto:ariesarsenal@gmail.com) so I can test your script with it? Thank you.
