UK Postcode Geocoder

UK Postcode Geocoder is a Google Sheets addon to convert UK postcodes into geographic information, including latitude/longitude coordinates, country, region and constituency.

Installation

You can install the addon to Google Sheets via the Google Chrome store.

Source code on Github.

How do I use it?

Select cells containing postcode data and click “Add-ons > UK Postcode Geocoder > Geocode selection” to convert the data into latitude/longitude.

Results will be displayed in a new sheet.

What do you mean by ‘UK postcodes’?

The application currently will only provide latitude and longitude coordinates for active (i.e. currently in use and no discontinued) UK postcodes according to the ONS’ Postcode Directory for November 2014 via postcodes.io: http://postcodes.io/about

Postcodes can be upper or lower case and contain no spaces or 1 space before the last 3 characters (see examples below). Other formatting is likely to return an error.

  • wc1e 6bt
  • wc1e6bt
  • SW4 0BY
  • SW40BY

Postcodes or zip codes from other countries will return a ‘not a valid postcode’ error.

Where is your data from?

This application uses UK postcode data under the Open Government Licence for public sector information.

The data is pulled from the postcodes.io API.

  • Bobo12345

    A very useful tool – thanks for creating it! 🙂

    I’d love to be able to use this in combination with a Google Form linked to a Sheet, so that the geolocation data was fetched as soon as a user submitted a postcode in their form entry. I have used the formMule and copyDown add-ons successfully in the past to calculate formulae on inputted data when a form is submitted. If it were possible to call your UK Postcode Geocoder add-on via a formula (don’t know if this possible in Google Sheets?) then I think it would be possible.

    Also, it would be great if one could change the settings to define what data to return from Postcodes.io. For example, one might prefer the eastings and northings data rather than latitude and logitude for easier distance calculations.

    Anyway, just some suggestions for you, but thanks again for the great plugin!

    Andy

    • Ed

      Thanks Andy, glad you’ve found it useful. And thanks for the suggestions – the Google Forms functionality sounds like it might work better as a separate application but the ability to define the data returned from postcodes.io is a good idea for this one. I’ll bear this in mind for any future development of the addon. Cheers, Ed