In this guide, we'll convert addresses to latitude and longitude and import this data into Airtable using the Google Maps Geocoding API and the Data Fetcher Airtable extension. We'll create a Google Maps Geocoding API key and then use it to the find latitude & longitude of specified addresses. This will all be done without using code.
Create a Grid view in the 'Locations' table called 'Needs coordinates' with the following filters:
The 'Address' field is not empty.
To use the Google Maps Platform APIs you need to set up a Google Cloud project. Follow these steps to create a project with a billing account.
After creating your account you'll be given an API key. Or find your Google Maps API key here.
To convert addresses to latitude and longitude, we will use the Geocoding API. This is a paid feature from Google, please read this page to understand the costs involved with the Geocoding API.
Install Data Fetcher from the Airtable marketplace. Either sign up for a free Data Fetcher account or if you already have an account, sign in using the 'Have an account?' option in the bottom left of the box.
On the home screen of the Data Fetcher extension, click 'Create your first request'. Requests enable you to import or send data to and from Airtable using Data Fetcher.
On the create request screen in Data Fetcher, for Application, select 'Google Maps'.
Next, enter your API Key (see previous step to find this).
For Endpoint, select 'Geocode - find latitude/ longitude from address'.
Enter a Name for your request, e.g. 'Find Latitude & Longitude'. Then click 'Save & Continue'.
Make sure the Output table & View are set to your 'Locations' table and 'Needs coordinates' view.
For Address click the + button in order to create a reference to our output table in Airtable.
A new window will open to create the table reference. For Field, select 'Address'. For Run every record select 'Needs coordinates'. (Or you could select an individual address.)
The 'Address' field is now referenced here:
Click 'Save & Run'.
Data Fetcher will send the request to the Google Maps Geocoding API and the Response field mapping window will open. This is where you set specific fields to import from Google Maps and how they should map to your selected output table in Airtable. For each Google Maps Geocoding API field, you can either import or filter it. For an imported field, you can set whether to map to an existing field or create a new one. You can also choose which field type to create.
Use the 'Filter all' button to clear any fields that are pre-selected, then you can use the 'Find field' search bar to find the fields you would like to import. For this example, we will import the 'Lattitude' and 'Longitude' fields.
Click 'Save & Run'.
Data Fetcher will now create any required fields in the output table, then run the request to the Google Maps API in order to lookup the latitude and longitudes for the addresses in the 'Locations' table.
Nov 9, 2022•
Rosie Threlfall•Google Maps
Mar 8, 2022•
Andy Cloke•Google MapsGoogle Places