user1592380
user1592380

Reputation: 36317

Trigger function by checking checkbox

enter image description here

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?

Upvotes: 7

Views: 16634

Answers (2)

Anshul Bansal
Anshul Bansal

Reputation: 47

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:

  1. Create a Trigger which executes status_check function every minute.
  2. Insert an "IF" condition, if the status of the cell is false, then do nothing.
  3. if "IF" is true then execute the necessary code.

This will work seamlessly with lag of just a minute.

Upvotes: -5

user1592380
user1592380

Reputation: 36317

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');

  }
}

Upvotes: 10

Related Questions