如何设置 Google 张 API 供个人使用

How to set up Google sheets API for personal use

我正在尝试按照说明进行操作 here which tell me to create credentials via the instructions here,第 6 步告诉我“单击您的应用程序的用户类型”。如果您是 运行 快速入门,select 内部。'

在相关页面上,'Internal' 显示为灰色,并告诉我不能 select 因为我不是 Google Workspace 用户。转到 Google 工作区,它告诉我我需要 'my business' 的域名。由于我没有业务,也没有任何与该项目有任何关系的领域(我只是想将一些个人数据从命令行推送到 sheet),我似乎不是能够继续。 Google 表格 API 是否不能用于此类用途?

如果您没有 Workspace 帐户但不想公开发布您的应用程序(并通过 Google 进行相关审核),您可以将应用程序设置为 External 并测试应用程序而不是发布它。

为此,只需在设置 OAuth 同意屏幕时将自己添加为 Test user,并将 Publishing status 保留在 Testing,不要将其更改为 In production:

Testing

Projects configured with a publishing status of Testing are limited to up to 100 test users listed in the OAuth consent screen. A test user consumes a project's test user quota once added to the project.

Google will display a warning message before allowing a specified test user to authorize scopes requested by your project's OAuth clients. The warning message confirms the user has test access to your project but should consider the risks associated with granting access to their data to an unverified app.

Authorizations by a test user will expire seven days from the time of consent. If your OAuth client requests an offline access type and receives a refresh token, that token will also expire.

参考: