Unable to get authorization

I keep getting the following error when launching Google script applications:

Execution failed: You do not have permission to call getFoldersByName

Here is the line of code that I am running:

var folders = DriveApp.getFoldersByName('Mission Response');

When I run the script editor from a script, it runs without any problems. However, I never get an authorization dialog (one that DriveApp allows). When I run the script from inside the spreadsheet, the script crashes with a runtime error above.

+4
source share
1 answer

After a big fight, I found a solution to this link .

, , , onEdit().

, , :

- :

function onEdit(){
  var folder = DriveApp.gefFoldersByName('My Folder Name').next();
  doSomething(folder);
  ...
}

:

function onEditTrigger(){
  var folder = DriveApp.gefFoldersByName('My Folder Name').next();
  doSomething(folder);
  ...
}

enter image description here

, , , .

+1

All Articles