小编Pat*_*mes的帖子

如何将 Google Cloud Platform 链接到 Google Sheet 脚本

如何使用 API-Key 或 OAuth2 将 Google Sheet 代码链接到我的付费 Cloud Platform 帐户。我有一个简单的应用程序脚本链接到一个简单的工作表,只要我在“免费”模式下使用它,它就可以完美地工作。但我无法让我的 Google Cloud Platform 帐户 API 与我的工作表一起使用。谁能帮我解决这个问题或告诉我我做错了什么?

工作表的作用:从连续的前三列中获取“发件人地址”、“收件人地址”和日期时间。然后我maps.newDirectionFinder()使用这三个输入参数进行调用。distance.value然后,我使用、duration.value和更新同一行中的其他三列duration_in_traffic.value。

下面是我的代码。使用 " 时Maps.setAuthentication(<client-id>, <secret-key>)",我在调用的行中收到“不允许操作”错误Maps.newDirectionFinder()。

注意:我启用的 API 包括:“Directions API”、“Google Sheets API”、“Distance Matrix API”、“Maps Javascript API”和“Roads API”。

代码(删除键):

/********************************************************************************
 * Library of Direction Finding and Route Optimization routines from Google Maps
 * Documentation of the Google Maps directionFinder functionality is here: 
 *       https://developers.google.com/apps-script/reference/maps/direction-finder
********************************************************************************/

// To do: 
// API Key (11/04/2018): <API-key> …
Run Code Online (Sandbox Code Playgroud)

google-maps google-sheets google-apps-script google-sheets-api

5
推荐指数
0
解决办法
314
查看次数