0
votes

I created a Google Script for work (that I don't want to share here) and that works perfectly fine with one onOpen() trigger.

Since I was working on that script on a personal Spreadsheet for testing purposes, I eventually moved it to the real Google Sheet it was meant to run on from the beginning and while the onOpen() function still works properly by being called via "Run function" or even "Debug function", the trigger is not fired, and I'm not getting any log or debug info that could potentially help me.

I deleted and recreated the trigger several times as I saw that this was a known work-around for the issue, but it's not changing anything. When I then go check "Current triggers", I see that it hasn't fired even once and I'm clueless as to what's causing this issue...

While not wanting to give away the whole script since it works anyway, I'm providing the code for my triggered function, even though it didn't change since it last worked successfully on my test spreadsheet:

function onOpen()
{
  var aSheet = SpreadsheetApp.getActiveSheet();
    var emailRow = 2;
    var emailColumn = 3;
    for(; !aSheet.getRange(emailRow, emailColumn).isBlank(); emailRow++)
    {
      aSheet.getRange(emailRow, 19).setValue(matchNPandCIO(emailColumn, emailRow));
    }
}

The only thing I can add and that's probably not related is that the spreadsheet on which I now have the script trying to run had an ownership change today and that I'm now its owner. I'm running out of ideas and things to try...

And yes, I also made sure that I gave the script the required authorizations it needs (done after creating the trigger).

1
Not super helpful, but in my experience it does sometimes take a while for changes to ownership to take effect in Google Apps Script land.Dustin Michels
Yeah, I was kind of hoping that this wouldn't be the issue because now that I've tried again, onOpen() is correctly triggered... haha!Sib

1 Answers

0
votes

Simple triggers like onOpen run anonymously so if matchNPandCIO calls methods that require authorization to run it will fail.

The alternative is to use an installable trigger.

Related