Search code examples
google-apps-scriptgoogle-sheetstriggers

Run an app script function if an exact cell contains a value in Google Sheets


Im hoping I get some help. Im looking to have a certain cell ("B2") trigger a function ("resetCheckbox") if that cell ("B2") says "Clear". Then following that, clear contents in that cell ("B2"). The current script i have for unchecking boxes works but i need to be able to set up a trigger that will work on an iPhone.

Here is the link to the Google spreadsheet:

Link to Spreadsheet

Any help would be greatly appreciated!


Solution

  • function onEdit(e) {
      const sh = e.range.getSheet();
      if(sh.getName() == "Your sheet name" && e.range.columnStart == 2 && e.range.rowStart == 2 && e.value == "Clear") {
        resetCheckbox();
      }
    }