Reputation: 331
I created an installable trigger in a standalone script.
When I change something in the target spreadsheet, nothing happens. I don't get to a brekpoint in onEdit
.
So how do I set up the trigger and onEdit
to detect Edits?
ScriptApp.newTrigger('myOnEdit'){
.forSpreadsheet('1wfcYwChzLmbqxoXoSZUrXgZJIVbtEyNUIpfxmJihAcY')
.onEdit()
.create();
)
function onEdit(e){
// Set a comment on the edited cell to indicate when it was changed.
var range = e.range;
var ct = e.changeType
var ov=e.oldValue
var nv =e.value
var sc=e.triggerUid
range.setNote('Last modified: ' + new Date());
}
Upvotes: 0
Views: 102
Reputation: 38130
onEdit
is a reserved function name to be used for on edit simple trigger. It should not be used for functions that will be called by an installable triggers as this could cause undesired effects as executing the function twice by a single event.
The installable trigger is being created to call a function named myOnEdit
. In order to make it works your script should have a function named myOnEdit
.
Upvotes: 1