I am aware of built-in triggers in google script API like:
- onEdit(event)
- onChange(event)
I need a function that triggers when user moves a cell around and saves the originalPosition of a cell and a target position of a cell.
For example:
1. user has in A1 something like this "val"
2. he drags the cell A1 to B3. (content & formatting and everything is moved to B3, A1 clears up).
onEdit(e) fires and I need to save the position "A1" and "B3" as original / target destination.
Is something like this possible in google sheet script?
My attempts:
Logger.log('val: %s', eventFired.range.getA1Notation());
[18-06-11 16:10:54:643 CEST] val: K5
range is saving only the target cell.
- eventFired.oldValue stores only old value in target cell
- eventFired.value stores only new value in target cell
I cannot find information about cell position it was moved from.
onChange(event)
reserved function name. A simple trigger for "Change" does not exist. The "change" event only exists for Sheets, and can only be used as an "installed" trigger. Event Objects You can get the range that was edited fromeventObject.range
You should be able to quickly write some simple code and test it to see what happens. UseLogger.log()
to see what the code is actually doing. Troubleshooting Apps Script – Alan Wells