# Clear cell after set time

**URL:** <https://community.glideapps.com/t/clear-cell-after-set-time/6323>\
**Category:** Ask for Help\
**Created:** [April 2, 2020, 7:05pm UTC](https://community.glideapps.com/t/clear-cell-after-set-time/6323 "2020-04-02T19:05:38Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![pete3905](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pete3905/32/4191_2.png) [@pete3905](https://community.glideapps.com/u/pete3905)\
**Post date:** [April 2, 2020, 7:05pm UTC](https://community.glideapps.com/t/clear-cell-after-set-time/6323/1 "2020-04-02T19:05:38Z")

</div>

I have a cell which I can only run on the spreadsheet due to its operator =(MRound(((H2\*128)/2500),0.5)) which clears via script & trigger when the form is submitted (on change/insert row).  
Issue I’m having is, if a user does not follow through with the form submit the calculation stays in place and the next user sees it.  
I would like to clear the cell after a set time (1 minute?)  
How?

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [April 2, 2020, 8:41pm UTC](https://community.glideapps.com/t/clear-cell-after-set-time/6323/2 "2020-04-02T20:41:40Z")

</div>

Add a time trigger to your script rather than just a form input trigger

---

<div class="post-metadata">

**Author:** ![pete3905](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pete3905/32/4191_2.png) [@pete3905](https://community.glideapps.com/u/pete3905)\
**Post date:** [April 2, 2020, 11:57pm UTC](https://community.glideapps.com/t/clear-cell-after-set-time/6323/3 "2020-04-02T23:57:17Z")

</div>

This is the trigger I added, doesn’t clear the cell:  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/4/474ab9dea578567bd332f63027a2f10b62baadf8.png)  
Something else I need to do?

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [April 3, 2020, 1:43am UTC](https://community.glideapps.com/t/clear-cell-after-set-time/6323/4 "2020-04-03T01:43:23Z")

</div>

This is the script I use:

```auto
function clearRange() {
   //replace 'Sheet1' with your actual sheet name
   //replace 'Range' with the range you want to clear
   var sheet = SpreadsheetApp.getActive().getSheetByName('Sheet1);
   sheet.getRange('Range').clearContent();
}

```

 ![Screen Shot 2020-04-02 at 9.42.59 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/7/79cdcf4a1ed25407c1c6a872a897b1918897b894.png)

---

<div class="post-metadata">

**Author:** ![pete3905](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pete3905/32/4191_2.png) [@pete3905](https://community.glideapps.com/u/pete3905)\
**Post date:** [April 3, 2020, 2:04am UTC](https://community.glideapps.com/t/clear-cell-after-set-time/6323/5 "2020-04-03T02:04:43Z")

</div>

So I can run this in conjunction with my other script and trigger?

And thank you for your help on this.

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [April 3, 2020, 2:30am UTC](https://community.glideapps.com/t/clear-cell-after-set-time/6323/6 "2020-04-03T02:30:01Z")

</div>

Pretty sure…just add this function to your other one and create a second trigger.

---

<div class="post-metadata">

**Author:** ![pete3905](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pete3905/32/4191_2.png) [@pete3905](https://community.glideapps.com/u/pete3905)\
**Post date:** [April 3, 2020, 5:10pm UTC](https://community.glideapps.com/t/clear-cell-after-set-time/6323/7 "2020-04-03T17:10:13Z")

</div>

It clears the cell on the Drive spreadsheet but not the Glide Data sheet.

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [April 3, 2020, 5:17pm UTC](https://community.glideapps.com/t/clear-cell-after-set-time/6323/8 "2020-04-03T17:17:26Z")

</div>

If there hasn’t been any other edits to the sheet, then Glide won’t recognize it…you’re right.

---

<div class="post-metadata">

**Author:** ![pete3905](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pete3905/32/4191_2.png) [@pete3905](https://community.glideapps.com/u/pete3905)\
**Post date:** [April 3, 2020, 6:01pm UTC](https://community.glideapps.com/t/clear-cell-after-set-time/6323/9 "2020-04-03T18:01:46Z")

</div>

So out of luck?

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [April 3, 2020, 6:15pm UTC](https://community.glideapps.com/t/clear-cell-after-set-time/6323/10 "2020-04-03T18:15:20Z")

</div>

Is your app a public app or private with email?

---

<div class="post-metadata">

**Author:** ![pete3905](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pete3905/32/4191_2.png) [@pete3905](https://community.glideapps.com/u/pete3905)\
**Post date:** [April 3, 2020, 6:23pm UTC](https://community.glideapps.com/t/clear-cell-after-set-time/6323/11 "2020-04-03T18:23:36Z")

</div>

Private with email

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [April 3, 2020, 6:46pm UTC](https://community.glideapps.com/t/clear-cell-after-set-time/6323/12 "2020-04-03T18:46:23Z")

</div>

Pro apps can be set to automatically sync with the google sheet every few minutes. Otherwise, the cleared fields would eventually sync up to glide once you perform some other edit to data in the app.

---

<div class="post-metadata">

**Author:** ![pete3905](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pete3905/32/4191_2.png) [@pete3905](https://community.glideapps.com/u/pete3905)\
**Post date:** [April 3, 2020, 9:43pm UTC](https://community.glideapps.com/t/clear-cell-after-set-time/6323/13 "2020-04-03T21:43:22Z")

</div>

Thank you.
