Auto toggle off with Google Script?

I have a field that contains a checkbox. Users can toggle the checkbox on or off when interacting with the field.

At midnight everyday, I need to reset all the toggles that have been switched ON back to the default OFF position. I believe I can achieve this with Google Scripts but would like some guidance (tutorials + pointers to Youtube videos). I’m a newb with Google Scripts, but I can follow logically and learn quickly.

Thanks.

I think a better alternative would be to use a button or some other component that allows you to perform an action. Or maybe an inline list with an action. And then have that action set a column value with a timestamp. Then based on that timestamp, you could hide the button or list item with a condition that checks it the timestamp is not within today or display a different image or emoji. At midnight it will automatically reset itself without the need for a script because it will be the next day from the day the timestamp was set. It’s not a switch or checkbox component, but you could use IF conditions and emoji’s or images to give the affect.

This isn’t an exact example, but I think it might give you an idea of what I’m talking about. I’m not opposed to scripts, but I think it’s easier and cleaner if you can have everything built into glide itself.

4 Likes

I like this approach. I feel like most of the time I try to avoid components where I can’t use an action.

2 Likes

Thank you very much. I will adapt the approach to use the button method. I was trying to avoid this route, but it appears this is the cleaner and more effective method to use.

Thanks Jeff!

1 Like