0

How can one tell the action triggered the onEdit function in Google Apps Scripting? The actions I have found to trigger it include:

  • edit a cell
  • delete a cell or range
  • cut or copy a cell or range
  • Copy a sheet

I would like something similar to the onChange's changeType attribute that tells me what the user did.

I need to react to what the user is doing. If they are deleting a cell, it can't be columns 1 or 2, but it can be 1 or 2 if they are deleting a row. If they duplicate the sheet, they need to be able to copy columns 1 and 2. I can't figure out how to tell the type of action the user did in any way. I'm faking it by looking at the row the user edited and the oldValue attribute, but it's not completely accurate and my code looks very brittle. The change event function doesn't have the attributes I need like source, range, oldValue, and value.

0

On Edit simple and installable triggers are only triggered when a range values change, the related event object doesn't has a changeType attribute. By using this kind of triggers there is no way to know how the user edited the range values.

Reference

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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