Max*_*nis 2 google-sheets google-maps-api-3 google-apps-script
我想根据 Google 表格中的名称和地址检索地点的位置,例如:
=PlaceAddress("White House, Washington, DC")
=PlaceAddress("Moma, New York, NY")
=PlaceAddress("Google, Mountain View, CA")
Run Code Online (Sandbox Code Playgroud)
这将返回结果(分别)出现在 Google 搜索中,即:
1600 宾夕法尼亚大道 NW, 华盛顿特区 20500
11 W 53rd St, 纽约, NY 10019
1600 Amphitheatre Pkwy, 山景城, CA 94043
Maps Apps Script 服务有一个地理编码器,但这似乎需要地址,而不是地名。我猜该解决方案涉及我在 Apps Script 中遗漏的某些功能,或者类似于ImportData从 Google 搜索或其他服务获取结构化数据的功能。
在谷歌Places API所能够做到这一点(要求的关键在这里)。设置这个:
B1 = 白宫
B2 = 华盛顿
B3 = 直流
A1:A3 可以是地方、城市、州
在任何单元格中输入用户定义的公式,如下所示:
=mapAddress(B1, B2, B3)
Run Code Online (Sandbox Code Playgroud)
在文本编辑器中复制并粘贴:
=mapAddress(B1, B2, B3)
Run Code Online (Sandbox Code Playgroud)
Places API限制为每天 1,000 个请求,但可以通过验证您的身份(仍然免费)将其增加到每天 150k。