0

[This Script]1 seems to be exactly what I want. Yet, it doesn't "Fire" when the reference cell is edited. That is, the target cell is not cleared. Just nothing happens upon editing the referenced cell. No error messages.

My script has been edited it to reflect specific named cells and the "Sheet 1" as the actual sheet's name i.e.'License':

function OnEdit(e) {

  if(e.range.getA1Notation() == 'RowNumber' && 
      e.range.getSheet().getName() == 'License'
    ) 
    e.source.getRange('InputPicHere').clear()
}

Any clues why it doesn't run?

0

1 Answer 1

0

The onEdit(e) function is simple trigger. Its name needs to be spelled exactly that, with no initial capital.

You can verify whether the function runs by checking My Executions.

2
  • It's been said you cant "run" an onEdit from the scripts editor to generate an "execution report." However, when you do the Execution log says: "TypeError: Cannot read properties of undefined (reading 'range') onEdit @ onEdit.gs:3" Whatever that means (or not). Feb 5 at 23:45
  • The onEdit(e) function is a simple trigger that is designed to run automatically when you manually edit the spreadsheet. In that context, the event object e is properly populated. Do not run the code through the ▷ Run button in the script editor. If you do, the event parameter e is not populated, causing the error you mention. To run the function, edit the spreadsheet. To see the executions, go to My Executions. Feb 6 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.