问题描述
限时送ChatGPT账号..我创建了一个谷歌表并使用 URL 将其转换为 JSON.示例:https://spreadsheets.google/feeds/list/SHEETID/od6/public/values?alt=json
我想在这个谷歌表中添加一个 api 密钥.我通过 Google Cloud Platform 生成了一个 API 密钥 - https://console.cloud.google/flows/enableapi?apiid=sheets.googleapis
现在,我如何将此 API 密钥添加到工作表中?请任何人帮忙.
解决方案我以为你的 端点 https://spreadsheets.google/feeds/list/SHEETID/od6/public/values?alt=json
适用于 Sheets API v3.看到Sheets API v3的官方文档,是这样写的.><块引用>
更新:Google Sheets v3 API 将于 2021 年 6 月 8 日关闭.
针对这种情况,我建议使用 Sheets API v4.如果电子表格是公开共享的,并且您想要从电子表格中检索值,您可以通过 API 密钥使用以下端点.参考
https://sheets.googleapis/v4/spreadsheets/[SPREADSHEETID]/values/[RANGE]?key=[YOUR_API_KEY]
在这种情况下,[SPREADSHEETID]
、[RANGE]
和 [YOUR_API_KEY]
是电子表格 ID,范围(您也可以分别使用工作表名称作为 [RANGE]
.) 和您的 API 密钥.
注意:
使用 API 密钥时,需要公开共享电子表格.请注意这一点.并且,API 密钥不能用于 GET 方法以外的方法.另外,请注意这一点.参考:
Google 表格 API v3迁移到 Google Sheets API方法:spreadsheets.values.get of SheetsAPI v4I have created a google sheet and have converted it into JSON using the URL. example: https://spreadsheets.google/feeds/list/SHEETID/od6/public/values?alt=json
I want to add a api key to this google sheet. I have generated a API key though Google Cloud Platform - https://console.cloud.google/flows/enableapi?apiid=sheets.googleapis
Now, how can i add this API key to the sheet?? Please could anyone help.
解决方案I thought that your endpoint of https://spreadsheets.google/feeds/list/SHEETID/od6/public/values?alt=json
is for Sheets API v3. When the official document of Sheets API v3 is seen, it says as follows.
Update: The Google Sheets v3 API will be shut down on June 8, 2021.
From this situation, I would like to propose to use Sheets API v4. If the Spreadsheet is publicly shared and you want to retrieve the values from the Spreadsheet, you can use the following endpoint using the API key. Ref
https://sheets.googleapis/v4/spreadsheets/[SPREADSHEETID]/values/[RANGE]?key=[YOUR_API_KEY]
In this case, [SPREADSHEETID]
, [RANGE]
and [YOUR_API_KEY]
are the Spreadsheet ID, the range (you can also use the sheet name as [RANGE]
.) and your API key, respectively.
Note:
When the API key is used, the Spreadsheet is required to be publicly shared. Please be careful this. And, the API key cannot be used for the methods except for the GET method. Also, please be careful this.References:
Google Sheets API v3 Migrate to the Google Sheets API Method: spreadsheets.values.get of Sheets API v4这篇关于如何将 API 密钥添加到谷歌电子表格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论