首页 > 解决方案 > 使用电子表格中的 API 密钥进行身份验证

问题描述

我在 Google 表格中有代码,它使用 Google Maps API 来计算两个位置之间的距离。我有一个 Google API 密钥,但不知道如何将它插入到我的代码中进行身份验证。我没有客户 ID。有人可以帮忙吗?

function DISTANCE(origin, destination) {
  var directions = Maps.newDirectionFinder()
    .setOrigin(origin)
    .setDestination(destination)
    .getDirections();
  return directions.routes[0].legs[0].distance.value;
}

标签: google-mapsauthenticationgoogle-apps-scriptgoogle-sheets

解决方案


推荐阅读