相关疑难解决方法(0)

使用 Google Compute Engine 上的应用程序默认凭据访问 Sheets API

ADC(应用程序默认凭据)工作流程是否仅支持 Google Cloud API(例如,支持 Google Cloud Storage API,但不支持 Google Sheet API)?

我指的是google.auth 的默认方法- 不必在代码中存储任何私钥是一个巨大的胜利,也是有效利用 ADC(应用程序默认凭据)设置的主要好处。

GOOGLE_APPLICATION_CREDENTIALS如果我将环境变量设置为私钥文件(例如 key.json),则以下代码将有效。default这与包中步骤 1 的方法一致google.auth1. If the environment variable GOOGLE_APPLICATION_CREDENTIALS is set to the path of a valid service account JSON private key file, then it is loaded and returned.

import google.auth
from apiclient import discovery

credentials, project_id = google.auth.default(scopes=['https://www.googleapis.com/auth/spreadsheets'])

sheets = discovery.build('sheets', 'v4', credentials=credentials)

SPREADSHEETID = '....'

result = sheets.spreadsheets().values().get(spreadsheetId=SPREADSHEETID, range='Sheet1!A:B').execute()

print result.get('values', [])
Run Code Online (Sandbox Code Playgroud)

现在,看看该方法的第 4 步: …

python google-authentication google-compute-engine google-cloud-platform google-sheets-api

7
推荐指数
1
解决办法
3317
查看次数

Google Sheets API - 如何在不与用户和浏览器交互的情况下进行身份验证?

我有一个 NodeJS API,需要使用 Google Sheets API V4 数据来填充数据库。

我一直在查看有关如何进行身份验证的文档,但我发现进行身份验证的所有方式都需要执行用户交互才能获取刷新的令牌

我需要一种无需与用户和浏览器交互即可执行身份验证的方法,有人可以帮助我吗?

Documentation I'm following: https://developers.google.com/sheets/api/

Thanks!

api google-api google-sheets node.js google-sheets-api

6
推荐指数
0
解决办法
2594
查看次数

每当使用 Cloud Function 添加新记录时,是否可以将数据从 Firestore 填充到 Google Sheet?

我正在尝试构建这个应用程序,我计划将我的数据存储在 Firestore 数据库中。我的客户需要 Google 表格中的数据。

我是否可以使用 Cloud Function 直接将 Firestore 中的记录填充到 Google Sheet,并且每当将新记录添加到 Firestore 时,Google Sheet 都会自动更新?

有人可以建议任何对这个主题有帮助的资源吗?

google-sheets google-cloud-functions google-cloud-firestore

1
推荐指数
1
解决办法
5991
查看次数