Google Apps Script无法授权:自建脚本访问表格遇「未验证应用」错误
Hey there, let's tackle that frustrating verification error you're facing when trying to authorize your Google Apps Script. I’ve dealt with this exact issue multiple times, so here’s a step-by-step breakdown to get you up and running:
Step 1: Bypass the Verification Warning (Safe for Your Own Script)
Since this is a script you created yourself, you can safely skip the unverified app warning:
- When you see the "This app isn't verified" screen, look for the tiny Advanced link at the bottom left corner and click it.
- Select the option that says Go to [Your Script Name] (unsafe) – the "unsafe" label is just Google's default for un-reviewed personal scripts, not a real risk here.
- On the next confirmation screen, click Allow to grant the necessary permissions to your script.
Step 2: Audit Your Script's Permission Scopes
Overly broad permissions can trigger this warning more often. Here's how to check:
- Open your script editor, go to File > Project properties > Scopes.
- Verify that the listed scopes only match what your script actually needs. For basic sheet access, the required scope is
https://www.googleapis.com/auth/spreadsheets. If you see extra scopes (like Gmail or Drive access you aren't using), simplify your code to remove those unnecessary permissions.
Step 3: Test with a Minimal Script
Sometimes the issue is tied to specific code in your project. Try creating a stripped-down test script to isolate the problem:
function testSheetAccess() { var sheet = SpreadsheetApp.getActiveSheet(); Logger.log("Accessed sheet: " + sheet.getName()); }
Run this function and go through the authorization flow again. A clean, minimal script often avoids caching or scope conflicts from your original code.
Step 4: Reset Your Account's App Permissions
If the above steps don’t work, clearing old permissions can resolve stuck authorization states:
- Go to your Google Account settings > Security > Third-party apps with account access.
- Find any entries linked to your script (they might appear as "Google Apps Script" or your project name), remove them, then return to your script and re-authorize from scratch.
内容的提问来源于stack exchange,提问作者Ian Steffy




