Home > Back-end >  Apps Script (Google Sheet) not allowing me to Run Script
Apps Script (Google Sheet) not allowing me to Run Script

Time:12-05

I have a fairly simple dataset in a Google Sheet. I created an AutoSort script. I saved it, and when I click "Run," I get the following errors. One from a pop-up, and another from the Execution Log.

Pop-up error:

Authorization required
This project requires your permission to access your data.

*For this error, there is a button to "Review Permissions" and I log in using my google account and then just nothing happens.

Execution Log error:

Warning This project requires access to your Google Account to run. Please try again and allow it this time.

The Owner of this Google Sheet is my personal Gmail account, and I am making these edits and created the script using my business Gmail Admin account. I also tried to access this sheet and run the script USING my personal Gmail account, and received the same error:

Google hasn’t verified this app The app is requesting access to sensitive info in your Google Account. Until the developer ({mypersonalemail}@gmail.com) verifies this app with Google, you shouldn't use it.

Any insight as to how I can authorize this would be appreciated. It sounds like something small I'm missing.

Also, in my personal email I receive a message with subject:

Review edits to your Apps Script project within your document

and it allows me links to access the worksheet and the script, but I don't see any way to approve the edits, or anything like that.

Expected behavior: What I am expecting is for the script to Run, when I click "Run."

CodePudding user response:

It's not a good idea to mix accounts from different domains, specially when using a free account and a Google Workspace account like you have done because that is the cause of the situation that you are facing.

My hypothesis is that the Google Cloud default project linked to the bounded script is created with the account used to create the project.

If you need that you personal account be the spreadsheet owner the best is to create the script using the personal account, and when needed, create a Google Cloud Standard project (GCSP) using the the personal account. You might try to fix the problem with your spreadsheet and the current Apps Script project by creating a GCSP, as was mentioned previously, by using the account that is the owner of the spreadsheet and linking it to the Apps Script project.

Note: If your script is using sensitive scopes you might have to set the OAuth Consent Screen publishing status to tes and add your Google Workspace account as tester.

Ref: Setting up your OAuth consent screen

Once you have finished the setup of your Google Apps Script project you should be able to use your Google Workspace account to update and run the Apps Script code but any new deployment and new version should be done using your personal account.

If you have access to Shared Drives and are allowed to use them for your spreasheet, consider to move it to a Shared Drive as this will make a lot easier to manage your script.

  • Related