Google script. Creat trigger automatically

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Google script. Creat trigger automatically



I am new in js and it is my first script. The idea of my project is creat event in my google calander every time when I edit (write values) to some cell. The problem is that I can't use onEdit() function because I need permission (use calander from sheet level). So I creat installable trigger like this:


function createEditTrigger() {
var ss = SpreadsheetApp.getActive();
ScriptApp.newTrigger('ToCalendar')
.forSpreadsheet(ss)
.onEdit()
.create();
}



Everything is fine but now I want creat this trigger automatically to my sheet not manually like I have now.



My idea was to use function onOpen() like this:


function onOpen() {
createEditTrigger();
Logger.log("hi");
}



but it of course will creat many the same triggers.



Is there any way to creat trigger automatically only once?
I will be grateful for all answers!









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Arduino Mega cannot recieve any sketches, stk500_recv() programmer is not responding

Visual Studio Code: How to configure includePath for better IntelliSense results

C++ virtual function: Base class function is called instead of derived