在Google Apps脚本"地图"类中使用API​​密钥

Car*_*cia 9 google-maps google-maps-api-3 google-apps-script

我们目前正在开始使用和Google Apps.我一直在Stack Overflow中搜索和搜索,试图解决这个问题:

我们有一个Google电子表格,我们在其中计算路线中不同点之间的总距离.像这样的东西:

示例 - 谷歌的电子表格

在我的Apps脚本中,我有这段代码:

 var directionFinder = Maps.newDirectionFinder();
  directionFinder.setMode(Maps.DirectionFinder.Mode.DRIVING);
  directionFinder.setOrigin(origin);
  directionFinder.setDestination(destination);
Run Code Online (Sandbox Code Playgroud)

我运行该功能,有时工作,有时不工作.令我恼火的是,当我进入我的Google云端控制台时,在我的API管理中,我没有看到任何API使用情况 - 即使我启用了API,也没有发生任何事情.


我知道我的问题与这些链接完全相同:

问题是,是否可以使用该Maps方法而不使用UrlfetchApp?目前使用Maps,我没有看到任何发生的事情,它可以随时工作.

我看到有一种方法Maps,例如:

Maps.setAuthentication(clientId, signingKey)
Run Code Online (Sandbox Code Playgroud)

我试着把我的projectId和API密钥放在这里,但我认为它没有做任何事情.