If you downloaded the example file I posted earlier on today, as well as a few updates to the simple versions of the Gmaps and geolocation functions for Excel, you may have noticed that one of the places on the clickable list of locations was “My location”.

This works using Wikimedia’s geoiplookup service. When I visit http://geoiplookup.wikimedia.org I get the following:

This code module downloads the response from Wikimedia and parses it into an array.

We can then query that array with a number of UDFs:

=My_City() returns the city.
=My_Country() returns the country.
=My_Location() returns the city and country.

=My_Lat() returns the latitude.
=My_Lng() returns the longitude.
=My_LatLng() returns the latitude and longitude.

=My_IP() returns the IP address.

The result from this is not particularly accurate. It will locate your general area reliably, unless you’re accessing the internet from behind something that masks your real IP address, but it won’t give you a precise location.

If I can figure out how to get the results of the code on this page here into Excel then I’ll make an update. This is using local wifi signals to locate your machine, just like your smartphone does. Unfortunately the code only works in Firefox or Chrome. The default browser object in Excel is Internet Explorer so it’s not simple to run.

It’s implementing some code from Samy Kamkar.

Jamie Bull | mail@oco-carbon.com

Related Posts

WiGLE is a popular platform which can be used for finding the location of a device using the names of WiFi networks in its vicinity. I’ve written about this before, and wrote some Python code to interact with their API. This API has since been retired and replaced with a new one, as of December […]

Just a quick post to point out a couple of really useful tools.The first is a web-based tool for finding weather files for a location of interest. It’s similar to the Excel EPW finder tool we created a few years back, but much more modern looking. It is however missing a few of the useful […]

Eppy is a really useful library which I’ve written about several times, since before I really had anything to offer in terms of contributing code. Over the past year or so though, I’ve started to contribute back some of the changes and additions I’ve made while using eppy on academic and commercial projects.This post is […]