V
V
Viktor Familyevich2017-12-11 13:40:12
Google Apps Script
Viktor Familyevich, 2017-12-11 13:40:12

How to correctly call the onChange function?

I want to make the function work when the formula (!) Changes the value in the cell. How to use it correctly? The code below throws an error: You do not have permission to call the function newTrigger at [unknown function](Code:8)

var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();

ScriptApp.newTrigger("myonChange")
   .forSpreadsheet(sheet)
   .onChange()
   .create();


function myonChange() {
 //код
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Samokhin, 2017-12-11
@Wintego

You are trying to create a trigger for a sheet, but you want a spreadsheet.
Need
instead
.forSpreadsheet(sheet)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question