1

I am getting an error that my script does not have permission to access Google Drive, and I'm not offered a way to grant access as I have seen before.

You do not have permission to call DriveApp.getFilesByName. Required permissions: https://www.googleapis.com/auth/drive (line 203, file "Code")

The problem started after authorizing clasp so I could develop locally. The same code worked before and does work in a backup copy of the Sheet.

Viewing my permissions here, it says that the project does have Drive permission even though I'm getting the error. https://myaccount.google.com/permissions

I tried withdrawing permission for the project and adding it back. When I did that, it only offered the option to grant Google Docs permission, not Google Drive permission.

On the assumption that changes to code trigger the permission granting dialog, I also tried removing the code that accesses Drive and putting it back but that didn't help either.

Dan Cancro
  • 1,401
  • 5
  • 24
  • 53
  • If you're using clasp you're likely specifying OAuth permissions in your manifest file. This will disable automatic scope detection. So, add the needed OAuth scopes to your manifest file. You can review the required scopes for every Apps Script service method in official documentation – tehhowch Mar 03 '19 at 20:38
  • 4
    Possible duplicate of [Permissions error using UrlFetchApp in Gmail Add-on](https://stackoverflow.com/questions/46923442/permissions-error-using-urlfetchapp-in-gmail-add-on) – tehhowch Mar 03 '19 at 20:39
  • @tehhowch thanks! That was it. – Dan Cancro Mar 03 '19 at 21:07
  • @tehhowch - I think you should add your comment as the answer :) Looks like it had solved OP's issue. – Sourabh Choraria Oct 28 '19 at 08:32
  • @sourabh no, I shouldn't. Op made a duplicate question. Op should accept the request to close this as a duplicate. – tehhowch Oct 28 '19 at 14:48

0 Answers0