0

I have google drive folder with subfolders, each subfolder has several google sheets and each sheet has a set of functions that run when users click on buttons, the issue is that for every time user try to run a function, google requests permission to run the script, I want to know if I can grant all our users to use the script on all files with out google prompting them each time they use a function

Here is the code that I tried and it ran without errors but it didn't accomplish anything:

function insertPermission() {

  var resource = {
    // enter email address here
    value: '[email protected]', 
    
    // choose from "user" or "group" if using a Google Group
    type: 'user',                
    
    // choose from: "owner", "writer" or "reader"
    role: 'writer'               
  };
  
  var optionalArgs = {
    sendNotificationEmails: false,
    supportsAllDrives: true,
  };
  Drive.
  Drive.Permissions.insert(resource, 'FolderIDGoesHere', optionalArgs);
  
}

Any suggestions how to perform that action will be much appreciated Thanks

1 Answer 1

0

By default each Google Apps Script bounded to spreadsheet project has its own Google Cloud default project, that it's why every time that a user try to run a Google Apps Script function for first time in a spreadsheet they are asked to authorize the script.

One option is to create a single Google Cloud standard project and link it to all the projects (I have not tried this).

Another option is to change your approach and instead of using bounded projects create Google Workspace Editor add-on. This implies to replace the "buttons" by an add-on supported feature like custom menu options, triggers or dialogs / sidebars created using the Google Apps Script HTML Service.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.