Google docs scripts asks for permission everytime

2019-06-09 20:26发布

问题:

So my question i have a google docs template which has a script with certain autofill criteria. After you click on use this template fine you get a file and when you run the script everytime is asks for permission to access the certain things google needs to identify you, it basically acts like its a new app everytime you create a new file from the template.

Is their a way of setting it won't ask for permission everytime?

回答1:

If you have a document bound script in your document, and if you will make a copy of that document and run the script, google app script will ask permission every time. Copying the document with script acts as if you have created a new script file and now script will ask permission on its first run.

Possible solution

You can publish your script as google document add-on. If you don't want to expose it publicly, you can also publish the add-on privately which only you or someone you will share with, can use.

check out the documentations

  • https://developers.google.com/apps-script/add-ons/publish#development_checklist
  • https://developers.google.com/apps-script/add-ons/domain-wide#publishing_for_domain-wide_installation

Publishing the add-on will bind your add-on to every document for google apps.