# Button in Google Sheet to 'Clear/reset'

**URL:** <https://community.glideapps.com/t/button-in-google-sheet-to-clear-reset/20764>\
**Category:** Ask for Help\
**Created:** [January 5, 2021, 2:39pm UTC](https://community.glideapps.com/t/button-in-google-sheet-to-clear-reset/20764 "2021-01-05T14:39:07Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon\_Hill](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/simon_hill/32/94730_2.png) [@Simon\_Hill](https://community.glideapps.com/u/Simon_Hill)\
**Post date:** [January 5, 2021, 2:39pm UTC](https://community.glideapps.com/t/button-in-google-sheet-to-clear-reset/20764/1 "2021-01-05T14:39:07Z")

</div>

Hi,

In previous posts it’s clear that Glide is working on a feature to allow users to clear data and perform a reset. But no news on when this valuable feature will be available.

In the meantime, can anyone share a workaround based on inserting a button directly in the Google Sheet? I have never worked with scripts but I assume this is the way to go. Does anyone have an example that would do the following:

- Button that allows users to Clear/Reset
- A warning appears before execution
- The range of rows or cells can be configured
- The action would clear pre-defined ranges in multiple tabs
- Ideally the action would not touch rows containing “=”, e.g. formulas - Although this is a ‘nice to have’

Lastly, can I assume the script would not interfere with the Glide App?!

Thanks in advance for any help!

Regards,  
Simon.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [January 5, 2021, 2:47pm UTC](https://community.glideapps.com/t/button-in-google-sheet-to-clear-reset/20764/2 "2021-01-05T14:47:01Z")

</div>

This is all doable with a script, and it could be triggered from Glide if you want to go that way.  
If you prefer to trigger from the Google Sheet, then I think I’d tend to favour a menu extension as opposed to a button.

I have some scripts that clear entire sheets (minus the header row) that I could share almost immediately.

If you wanted something that addresses all of your points, I could create this for you, but I’d probably need a day or two.

---

<div class="post-metadata">

**Author:** ![Simon\_Hill](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/simon_hill/32/94730_2.png) [@Simon\_Hill](https://community.glideapps.com/u/Simon_Hill)\
**Post date:** [January 5, 2021, 3:00pm UTC](https://community.glideapps.com/t/button-in-google-sheet-to-clear-reset/20764/3 "2021-01-05T15:00:53Z")

</div>

Hi Darren,

Thanks for the great response. Sounds promising. Can I just ask, would the menu extension work only on my version of Google or would anyone with the sheet have that access?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [January 5, 2021, 3:05pm UTC](https://community.glideapps.com/t/button-in-google-sheet-to-clear-reset/20764/4 "2021-01-05T15:05:13Z")

</div>

Anyone with `Edit` access can run scripts (or create new ones, or edit existing ones).  
Folks with `View` access cannot do any of the above.

---

<div class="post-metadata">

**Author:** ![Simon\_Hill](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/simon_hill/32/94730_2.png) [@Simon\_Hill](https://community.glideapps.com/u/Simon_Hill)\
**Post date:** [January 5, 2021, 3:48pm UTC](https://community.glideapps.com/t/button-in-google-sheet-to-clear-reset/20764/5 "2021-01-05T15:48:40Z")

</div>

Then that sounds perfect. I want to be able to share a copy of my Glide App and then handover ownership of the Google Sheet, preferably with a feature to reset/clear some rows.

So if it worked through the menus, what would the user see? Could there be a new menu option added?

If you can share an example I could copy/import I would be super grateful!

---

<div class="post-metadata">

**Author:** ![Simon\_Hill](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/simon_hill/32/94730_2.png) [@Simon\_Hill](https://community.glideapps.com/u/Simon_Hill)\
**Post date:** [January 7, 2021, 4:31pm UTC](https://community.glideapps.com/t/button-in-google-sheet-to-clear-reset/20764/6 "2021-01-07T16:31:48Z")

</div>

Thanks to everyone above for their input. However, I think I have found a good solution - at least better for me, since it requires no script editing!

1. Insert a graphic for a button into the Google Sheet, e.g. [RESET]

2. In the menu, select Tools, Macros, Record Macro…

3. Perform the required set of actions, e.g. clearing cells by selecting and deleting values and save the macro

4. Select the button icon, click on the 3 dots to open the graphic menu & select ‘Assign Script’

Now every time the button is selected the macro runs and it performs the reset. It even works on multiple sheet tabs at the same time.

I recommend beginners practice on a duplicate Sheet before working on the actual sheet. I love this since it requires no scripting. I understand the script might also be triggered via an event in a Glide App, but for now this is my simple workaround solution.

My next step is to check that when my Glide App is copied the sheet can be copied with the reset button and script included. I’m assuming yes… let’s see.

---

<div class="post-metadata">

**Author:** ![VTPharaoh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/vtpharaoh/32/39837_2.png) [@VTPharaoh](https://community.glideapps.com/u/VTPharaoh)\
**Post date:** [February 28, 2022, 8:30pm UTC](https://community.glideapps.com/t/button-in-google-sheet-to-clear-reset/20764/7 "2022-02-28T20:30:11Z")

</div>

@Simon_Hill I love your solution for this. I am VERY new to Glide and need a way for a button in Glide to uncheck all previous checkbox selections. Is there a way to activate a script from a button in Glide?

---

<div class="post-metadata">

**Author:** ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)\
**Post date:** [February 28, 2022, 9:39pm UTC](https://community.glideapps.com/t/button-in-google-sheet-to-clear-reset/20764/8 "2022-02-28T21:39:58Z")

</div>

You could do that with an ‘onChange’ Trigger. Here’s an example where I use a named range in sheets… only when that named range is not blank will the script fire. I clear the content at end of script to ready it for new.

```auto
function csv_sheet_change() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var trigger = ss.getRangeByName('CSVTrigger').getValue();
  if (trigger != '') {
    console.log("Sending CSV");
    emailCSV();
    ss.getRangeByName('CSVTrigger').clearContent();
  } 
}

```

Courtesy of @Darren_Murphy

---

<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:** [March 1, 2022, 2:32am UTC](https://community.glideapps.com/t/button-in-google-sheet-to-clear-reset/20764/9 "2022-03-01T02:32:15Z")

</div>

This is also something you could consider.

> [@Reset Multiple Rows At Once](https://community.glideapps.com/t/reset-multiple-rows-at-once/22211):
>
> There have been several requests for people to find a way to clear a value in multiple rows. I was thinking about that and came up with a quick example of a way to handle that. Instead of trying to clear a value in an entire column, I realized we could just change one value on a parent column, load it as a single value in our sheet and then compare that parent value to a column that we set or unset for each row. It’s not about clearing an entire column, it’s about making a value in each row n…

---

<div class="post-metadata">

**Author:** ![Simon\_Hill](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/simon_hill/32/94730_2.png) [@Simon\_Hill](https://community.glideapps.com/u/Simon_Hill)\
**Post date:** [March 1, 2022, 2:00pm UTC](https://community.glideapps.com/t/button-in-google-sheet-to-clear-reset/20764/10 "2022-03-01T14:00:11Z")

</div>

I now prefer this better way to clear columns:

> [@Choice component MULTI-SELECT: now a dream, soon a reality?](https://community.glideapps.com/t/choice-component-multi-select-now-a-dream-soon-a-reality/16204/19):
>
> Sharing a basic example of how to clear columns with one button press. This uses relations, which is manageable so long as you have a relatively small number of rows to reset. [[Clear column app in Glide] ](https://www.youtube.com/watch?v=HnfdqrBDNKg)[link to glide app](https://willing-sense-6946.glideapp.io/dl/ewAiAHQAIgA6ADAALAAiAHMAIgA6ACIAYwBsAGEAcwBzAC0AbgBhAHQAaQB2AGUALQB0AGEAYgBsAGUALQA5AHcAVwBUAFIAOABWAFIAbABiAGEAQgBtAGoAWAA0AFkAYwBSAHIAIgAsACIAcgAiADoAIgA1ADUAVAB5AEEAawBGAHYAUwB5ADIAbwBRADYAWgBPAEoALgBIADEASgBBACIALAAiAG4AIgA6ACIAUwBpAG0AbwBuACIAfQA%3D)

---

<div class="post-metadata">

**Author:** ![VTPharaoh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/vtpharaoh/32/39837_2.png) [@VTPharaoh](https://community.glideapps.com/u/VTPharaoh)\
**Post date:** [March 1, 2022, 2:45pm UTC](https://community.glideapps.com/t/button-in-google-sheet-to-clear-reset/20764/11 "2022-03-01T14:45:09Z")

</div>

I also had almost the exact same thought. However my Apps Script abilities are very limited. Maybe you can help me since your script looks like what I want to do.

Here’s the layout of my app. I work with and mentor college students, and it’s an app to help me understand where they’re at and help them process as well. In the setup a user will scroll through a list of “cards” and select a few they think are most applicable for the context they’re in. Later this list is presented to the student and they select two they feel describes them the most. So I have a UserSelection tab and an AudienceSelection tab. The AudienceSelection populates with what is selected by the User and each has a column of checkboxes.

I was able to make a button in Glide that toggles the checkbox to True on the selection screens using “Set column values in this row.” So here’s what I’m thinking (again I’m very new to Glide). There will be an introduction screen to the app with a “Let’s Go” button. That will have custom action set to Toggle a checkbox in my Setup tab to true, then again to false (I do both to make sure it actually changes), then open the UserSelection tab. In sheets there’s an App Script for OnChange to clear the named ranges I have for the checkboxes on UserSelection and AudienceSelection tabs. Does this make sense?

I haven’t read Jeff’s article yet. I glanced at Simon’s and I think I have too many selection options for that.

---

<div class="post-metadata">

**Author:** ![VTPharaoh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/vtpharaoh/32/39837_2.png) [@VTPharaoh](https://community.glideapps.com/u/VTPharaoh)\
**Post date:** [March 1, 2022, 2:46pm UTC](https://community.glideapps.com/t/button-in-google-sheet-to-clear-reset/20764/12 "2022-03-01T14:46:43Z")

</div>

@Simon_Hill this is a really creative and easy way to do it if I didn’t have so many selections. There will be 2 separate selection screens with up to 12 options on each. Still probably doable…but I feel like there has to be something a little more elegant haha.

---

<div class="post-metadata">

**Author:** ![VTPharaoh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/vtpharaoh/32/39837_2.png) [@VTPharaoh](https://community.glideapps.com/u/VTPharaoh)\
**Post date:** [March 1, 2022, 3:08pm UTC](https://community.glideapps.com/t/button-in-google-sheet-to-clear-reset/20764/13 "2022-03-01T15:08:22Z")

</div>

@Jeff_Hager Ok this looks exactly like what I might need… I haven’t used IF/Then in Glide yet and I’m just getting the hang of Relations but I’m pretty sure I grasp what’s going on. I opened your app and copied it to look at how it works. One thing I don’t understand: When the app is opened it has a blank screen (the RichText?) and a “Tap to Start” button. How did you hide everything else behind that? This is definitely something I could use in the app I’m making!

---

<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:** [March 2, 2022, 3:04am UTC](https://community.glideapps.com/t/button-in-google-sheet-to-clear-reset/20764/14 "2022-03-02T03:04:19Z")

</div>

That’s just a visibility condition set on all of the components on the screen. If the Parent ID is empty, then the rich text and start button show. If the Parent ID is not empty, then all of the other components are shown on the screen.

---

<div class="post-metadata">

**Author:** ![VTPharaoh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/vtpharaoh/32/39837_2.png) [@VTPharaoh](https://community.glideapps.com/u/VTPharaoh)\
**Post date:** [March 2, 2022, 7:58pm UTC](https://community.glideapps.com/t/button-in-google-sheet-to-clear-reset/20764/15 "2022-03-02T19:58:24Z")

</div>

Ahh. I didn’t realize that was an option! Thanks for the tip!

---

<div class="post-metadata">

**Author:** ![NoCodeAndy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nocodeandy/32/62530_2.png) [@NoCodeAndy](https://community.glideapps.com/u/NoCodeAndy)\
**Post date:** [January 17, 2024, 4:49pm UTC](https://community.glideapps.com/t/button-in-google-sheet-to-clear-reset/20764/16 "2024-01-17T16:49:35Z")

</div>


