How to connect the Postcodes.io API to Google Sheets

Postcodes.io is a free postcode lookup API and geocoder for the UK. We can use the Postcodes.io API to import data from Postcodes.io into Google Sheets. In this tutorial, we’ll show you how to connect the Postcodes.io API to Google Sheets in 4 steps:

  1. Install the Apipheny add-on
  2. Choose a Postcodes.io endpoint
  3. Enter your Postcodes.io API request into Apipheny
  4. Run the Postcodes.io API request in your Google Sheet

Step 1.) Install and open the Apipheny add-on in Google Sheets

To pull data from the Postcodes.io API to Google Sheets, first install and open the Apipheny Google Sheets add-on.

Apipheny is a no-code API integrator for Google Sheets that you can use to make unlimited API requests, connect to unlimited APIs, save API requests, schedule API requests, and more. 

1. Install Apipheny by opening the following link on desktop and then clicking the Install button on the page: https://apipheny.io/install

2. After you’ve installed Apipheny, open a Google Sheet and then click on the Add-Ons or Extensions option in the top menu. In the add-ons menu, you should see Apipheny.

Click Apipheny > Import API to open the Apipheny sidebar in your Google Sheets.

open apipheny

Step 2.) Choose a Postcodes.io Endpoint

In this section, we’ll show you how to browse the Postcodes.io API documentation to find the endpoint that retrieves the information you need from your account. If you already know your API URL, or you want to use the same example URL as us, just skip to Step 3.

First, open the Postcodes.io API documentation page: http://postcodes.io/docs

Postcodes.io API documentation page
Postcodes.io API documentation page

This page contains general information about the Postcodes.io API and a list of Methods (Endpoints):

Postcodes.io Methods section
Postcodes.io Methods section

If you scroll down you will find the endpoints:

An example endpoint is Postcode Validation, which validates a given postcode. The URL for this endpoint is:

https://api.postcodes.io/postcodes/POSTCODE/validate

If you use this URL, don’t forget to replace POSTCODE with a real postcode value.

Each endpoint’s documentation contains a description of the response it returns, its HTTP method and URI, as well as additional details about its operations (the parameters it takes, the rules it applies, etc.).

Postcode Validation Endpoint
Postcode Validation Endpoint

All endpoints can be accessed from the following base domain: https://api.postcodes.io

Step 3.) Enter your Postcodes.io API request into Apipheny

Now go back to your Google Sheet and make sure that the Apipheny add-on is open on the “Import” tab. With the Import tab open, enter these details into the add-on:

Method: At the top of the Apipheny sidebar, select the HTTP method (GET or POST) required by your API endpoint. For this example, we are using the GET method.

API URL: In Step 2, we explained how you can find the Postcodes.io API endpoint that you need. Now copy and paste your complete Postcodes.io API URL into the Apipheny add-on, where it says API URL Path, followed by any parameters required for your query (if applicable).

For this example, we are using the Lookup a postcode endpoint, which retrieves details about a specific postcode. This is what the whole URL looks like:

https://api.postcodes.io/postcodes/POSTCODE

If you use this URL, you should replace POSTCODE with a real value of a postcode located in UK.

Headers aren’t required. This API does not require any authentication. You can leave the Headers section blank in Apipheny.

 Postcodes.io API request entered into Apipheny
Postcodes.io API request entered into Apipheny

Step 4.) Run the Postcodes.io API Request in Your Google Sheet


Finally, the last step is to click the Run button at the bottom of the Apipheny add-on and then wait for the Postcodes.io API data to be imported into your Google Sheet. Here’s what our request looked like when completed:

Postcodes.io data imported into Google Sheets
Postcodes.io data imported into Google Sheets

That’s it! You’ve successfully connected your Postcodes account to Google Sheets using the Postcodes.io API, Google Sheets API, and the Apipheny add-on.

After making a successful request to the Postcodes.io API, try querying a different Postcodes.io API endpoint, or try using one of the more advanced features in the Apipheny add-on.


API Tutorials



Related Posts