问题描述
我想知道是否可以在Google Spreadsheet上使用一个公式/脚本来获取IP地址数组的城市,位置.
I would like to know if there is a formula/script one could use on Google Spreadsheet to obtain the City,Location of an array of IP addresses.
例如,假设A列上的每个单元格都有100个IP地址,我应该在B列上使用哪种公式/脚本来获取各自的城市和位置?
i.e lets imagine that each cell on column A has 100 IP addresses, what formula/script should I use on column B to get the respective city and location?
推荐答案
经过一番挖掘,我终于知道了如何做到这一点.
After some digging I've figured out how to do this.
-
将
import_json_appsscript.js
脚本复制到 https://gist.github.com/chrislkeller/5719258 .这将是脚本,它将为Google电子表格创建ImportJSON()
函数
Copy the
import_json_appsscript.js
script on https://gist.github.com/chrislkeller/5719258. This will be the script that will create theImportJSON()
function to a Google spreadsheet
转到Google电子表格,在菜单栏上转到工具">脚本编辑器"
Go to Google spreadsheet, on the menu bar got to Tools > Script Editor
将import_json_appsscript.js
粘贴复制到脚本编辑器中并保存,仔细检查您是否可以在选择功能"下拉菜单上看到ImportJSON()
功能.
Copy paste import_json_appsscript.js
into the Script Editor and save it, Double check that you can see the ImportJSON()
function on the Select function drop down menu.
在电子表格上使用= ImportJSON(URL,查询,选项)函数,例如=ImportJSON("http://freegeoip.net/json/75.148.30.137", "/city", "noHeaders")
从FreeGeoIP调用中检索Baltimore
.
On the Spreadsheet use function =ImportJSON(url, query, options), for example =ImportJSON("http://freegeoip.net/json/75.148.30.137", "/city", "noHeaders")
to retrieve Baltimore
from the FreeGeoIP call.
希望有帮助,它肯定回答了我的问题.
Hope that helps, it certainly answers my question.
这篇关于在Google Spreadsheet上,您如何称呼IP的城市或国家/地区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!