Geo code from ip and host names
Today’s API is a straightforward query per row, meaning that data is retrieved from the API using the contents of a column as the query. In this case the host column provides the query data. The freegeoip API will take a host name and ip address and provide geolocation data for it. Here’s how to do it in bulk directly from Excel or Google Apps Script. In a future post, i’ll mashup this with integrating Excel with Google Maps and Google Earth to plot them directly on a map. This example can be found in the cDataSet.xlsm and downloaded from here
With .add("freegeoip") .add "restType", erRestType.erQueryPerRow .add "url", "http://freegeoip.net/json/" .add "results", "" .add "treeSearch", False .add "ignore", "" .add "append", "" End With
Public Sub testfreeGeoIP() generalDataSetQuery "freegeoip", "freegeoip", "host" End Sub
and for Google apps script
function testfreeGeoIP() { mcpher.generalDataSetQuery ("freegeoip", "freegeoip", "host"); }