google script error “You do not have permission to call create (line 38, file ”macros“)”

橙三吉。 提交于 2019-12-02 21:43:57

问题


var newSpreadsheet = SpreadsheetApp.create("Spreadsheet to export");

I am running a Google Sheet script and I get the following error message on the above line of code. Any idea how to solve the issue? I am a novice.

Error message:

You do not have permission to call create (line 38, file "macros")


回答1:


You're probably running in a script project that is scoped to only the current document. You can check your current requested scopes in the menu, via File -> project properties -> Scopes. Check this list for one like spreadsheets.currentonly.

If one like it is there, you have either directly or indirectly specified // @OnlyCurrentDoc in your code files (including imported Apps Script libraries).

If this is from a library inclusion, then either add // @NotOnlyCurrentDoc in your code (usually positioned at the start of your first .gs file) or edit your manifest file to manually specify the desired scopes. If it is from your own code specifying //@OnlyCurrentDoc, then just remove this comment.

Scripts which scope to only the current document will generally not trigger the aggressive "Unverified App" authentication flow in which you and/or other document editors must first select "Advanced -> proceed anyway" to approve the script.

See also:

  • https://stackoverflow.com/a/50458893
  • https://stackoverflow.com/a/39757366


来源:https://stackoverflow.com/questions/50859119/google-script-error-you-do-not-have-permission-to-call-create-line-38-file-m

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!