情况:
我有一个 Google 表格,我希望使用网址和 API key 访问其数据,例如:
https://sheets.googleapis.com/v4/spreadsheets/{SHEETS-ID}/values/{RANGE}?key={API-KEY}
只有当工作表公开可用时,此功能才有效,即“知道链接的任何人都可以查看”。我希望不允许链接共享。我在 Apps 脚本中看到可以添加对服务帐户的访问权限。
问题:
如果您只有 API key 并使用上述 URL 请求数据,这也可行吗?
最佳答案
不,仅使用 API key 无法访问私有(private)数据。如 documentation 中所述:
If the request requires authorization (such as a request for an individual's private data), then the application must provide an OAuth 2.0 token with the request. The application may also provide the API key, but it doesn't have to.
无论如何Google Sheet API将使您的生活更轻松地构建请求和检索私有(private)数据。
关于google-apps-script - Google Sheets 可以添加 API key 访问权限吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60900014/