I have a sheet with checkboxes in the first column. I would like to be able to trigger a function by checking a box. Right now all the checkboxes are set to false/unchecked. Is there anyway to trigger an event by checking a box?
-
3See TriggersChris– Chris2019-02-28 22:38:25 +00:00Commented Feb 28, 2019 at 22:38
-
1Is this thread useful for your situation? stackoverflow.com/q/54856739/7108653Tanaike– Tanaike2019-02-28 23:15:34 +00:00Commented Feb 28, 2019 at 23:15
-
Possible duplicate of onEdit() doesn't catch all changesWicket– Wicket2019-03-01 04:09:44 +00:00Commented Mar 1, 2019 at 4:09
-
This is interesting. I see that the event can have a range. Is there information on which sheet in a spreadsheet that generated it?user1592380– user15923802019-03-01 16:51:56 +00:00Commented Mar 1, 2019 at 16:51
-
1Yes , that's what I wanted to know. Thank you.user1592380– user15923802019-03-02 14:31:50 +00:00Commented Mar 2, 2019 at 14:31
|
Show 4 more comments
2 Answers
The following is not much of an answer, but does log ONEDIT when clicking or unclicking a checkbox. Maybe it can be used as a start for something more complicated.
function onEdit(e){
if (e.range.columnStart == 1 && e.range.columnEnd == 1 && e.range.rowStart <= 2000) {
Logger.log('ONEDIT');
}
}
1 Comment
Magne
Yes, see: stackoverflow.com/questions/12583187/…
When you Insert a checkbox, the cell value can either be true or false. So, in my opinion, create a function "status_check" and do the following:
- Create a Trigger which executes status_check function every minute.
- Insert an "IF" condition, if the status of the cell is false, then do nothing.
- if "IF" is true then execute the necessary code.
This will work seamlessly with lag of just a minute.
2 Comments
carbontracking
A lag of one minute is a total showstopper in general.
TheMaster
@carbontracking No it's barely like a 1-2 seconds at most
