Reputation: 13
I am running a script in google sheets script editor, to trigger the script I use the installable trigger onChange()
. I followed the steps available on in the documentations.
But nothing happen when I do something on my worksheet.
Here is my code
function createSpreadsheetChangeTrigger() {
var ss = SpreadsheetApp.getActive();
ScriptApp.newTrigger('onChange')
.forSpreadsheet(ss)
.onChange()
.create();
}
function onChange(){
Logger.log("onChange event fired");
}
I don't understand what is going wrong. Can anyone help me please?
Thanks
Upvotes: 1
Views: 2217
Reputation: 149
What you have will work, but you have to actually "install" the trigger first. To do that go to Edit --> Current Project's Triggers. Click on the link No triggers set up. Click here to add one now and make the selections below:
Now check your Logger after making a change to your spreadsheet and you get:
Hope this helps!
Upvotes: 1
Reputation: 18707
But nothing happens when I do something on my worksheet.
You have to add a row, add a column, delete a row or delete a column to trigger onChange()
.
I think you need onEdit
trigger. It fires when the range is edited.
I'm looking for an event that will be fired when the user is selecting something on the spreadsheet
This is currently not possible that's all we have:
The reason developers did not include such a trigger:
onSelect
trigger would crash the server.Upvotes: 2