Look Up Geolocation, Rating, Opening Hours in Airtable using Google Places API

In this guide, we'll look up business geolocation, rating & opening Hours in Airtable. We're going to use the Data Fetcher app to do connect to the Google Places API and pull in this information with no-code.

Add Business Names

Add all the business names you want to look up in the 'Name' field in your Airtable table. If you have full addresses, use those. If not, a name and city are sufficient.

business-names-airtable.png

Add the following fields:

  • A single line text field called 'Place id'.
  • A number field called 'Rating'.

Then create a new Grid view called 'Needs place id' with the following filters:

  • 'Name' is not empty.
  • 'Place id' is empty.
needs-place-id-view.png

Then create another new Grid view called 'Needs details' with the following filters:

  • 'Place id' is not empty.
  • 'Rating' is empty.
Screenshot 2022-02-14 at 12.49.35.png

Get a Google Maps Distance Matrix API Key

  • Follow these steps to create a project with a billing account and the Places API enabled.
  • Then follow these steps to create an API key for the Places API.
  • Note that the places is a paid API from Google. Looking up different fields incurs a different additional cost. Check out this page to understand the costs involved.

Install Data Fetcher

Install Data Fetcher from the Airtable app marketplace. After the app launches, sign up for a free Data Fetcher account by entering a password and clicking 'Sign up for free'.

Group 1Data Fetcher Sign Up .png

Look Up Place Id From Business Name in Airtable

The first thing we need to do is look up a unique place id for every business name in our table. We will then use this id to look up further details (opening hours, geolocation etc.) about each business.

On the home screen of the Data Fetcher app, click 'Create your first request'. Requests in Data Fetcher are how you import data to or send data from your Airtable base.

click-create-your-first-request.png

On the create request screen in Data Fetcher, for Application, select 'Google Maps'.

google-maps-application-selected.png

Next, enter your API Key from the previous step.

google-maps-authorization-api-key.png

For Endpoint, select 'Find a place from name/address/phone number'.

google-places-name-endpoint.png

Enter a Name for your request, e.g. 'Import Place Id'. Then click 'Save & Continue'.

google-maps-place-from-name-save-continue.png

We want to use the values in our 'Name' field for Input. Under Name, click the + button to insert a reference to the table.

google-maps-input-add-icon.png

A modal will open where we can create the table reference. For Field, select 'Name'.

google-maps-input-reference-field.png

For Run for every record in view, select 'Needs place id'. Click 'Confirm'.

needs-place-id-reference.pnggoogle-maps-input-reference-confirm.png

The Input now has a reference to our table.

google-maps-input-reference.png

For Fields, select 'Place id'. For now, we're just going to look up the place id, as we need to use it to look up opening hours and other details.

google-maps-place-id.png

Click 'Save & Run'.

Screenshot 2022-02-14 at 12.45.22.png

The request will run and the Response field mapping modal will open. This is where you set which fields to import from the Google Places API and how they should map to your output table. For each Google Places API field, you can either import or filter it. For an imported field, you can set whether to map them to an existing field or create a new field.

Make sure 'Place id' is imported and mapped to the existing 'Place id' field. Then click 'Save & Run'.

Screenshot 2022-02-14 at 12.43.31.png

Data Fetcher then run the request again for every record and look up the Google Places place id based on the business name. The records in the 'Needs place id' view will be updated and move out of the filtered view.

google-maps-imported-place-ids.png

Click 'Back' to return to the Data Fetcher home screen.

Look Up Geolocation, Rating, Opening Hours in Airtable using Google Places API

Now we will create a second request using the place ids to look up details about each business such as geolocation, overall use rating & opening hours.

On the Data Fetcher home screen, Click 'Create request'.

google-maps-create-request.png

On the create request screen, for Application, again select 'Google Maps'.

google-maps-application-selected.png

Your API Key should populate automatically.

google-maps-authorization-api-key.png

For Endpoint, select 'Find details for a place id'.

google-maps-place-details-for-place-id.png

Enter a Name for your request, e.g. 'Import Place Details'. Then click 'Save & Continue'.

google-maps-place-details-save-continue.png

We want to use the values in our 'Place id' field for Place id. Under Place id, click the + button to insert a reference to the table.

google-maps-place-id-add-icon.png

A modal will open where we can create the table reference. For Place id, select 'Place id'. For Run on every record in view, select 'Needs details'. Then Click 'Confirm'.

Screenshot 2022-02-14 at 12.51.07.png

Place id now has a reference to our table.

google-maps-place-id-reference.png

Select the Fields you want to import from Google Places. Most of these should be self-explanatory but note the following:

  • 'URL' is the URL of the place on Google Maps, whereas 'Website' is the URL of the actual business's website.
  • 'Rating' is the average for all Google reviews, e.g. '4.7'.
  • 'User rating total' is the number of Google reviews the business has.
  • 'Geometry' includes latitude and longitude for the business location as well as the viewport shown on Google Maps.
Screenshot 2022-02-14 at 12.22.45.png

Click 'Save & Run'.

Import the fields you want on the Response field mapping, then click 'Save & Run'.

Screenshot 2022-02-14 at 12.53.58.png

Data Fetcher will create the missing fields in the table, then run the request again and import rating, geolocation, opening hours and other fields for every business in the 'Needs details' view.

Screenshot 2022-02-14 at 12.55.36.png

Look Up Geolocation, Rating, Opening Hours in Airtable using Google Places API Automatically

At the moment you have to calculate the delivery time & distance by manually clicking the 'Run' button for each request. Lets combine the two requests into a sequence, then schedule this to run automatically.

On the Data Fetcher home screen, click the blue dropdown icon, then click 'Create sequence'.

create-sequence-button.png

Give the sequence a name, like 'Import Place Id & Details'.

Select 'Import Place Id' for the first request and 'Import Place Details' for the second. Then click 'Save'.

Import Place Id & Details sequence.png

In Data Fetcher, scroll to Schedule and click 'Upgrade'.

schedule-upgrade.png

A new tab will open where you can select a plan and enter your payment details to upgrade.

Screenshot 2021-12-29 at 10.25.19.png

Return to the Data Fetcher app and click "I've done this".

schedule-ive-done-this.png

Click 'Add API key' in order to add your Airtable API key. You can find your Airtable API key here.

Group 11(1).png

Enter your Airtable API key and click 'Save'.

save-airtable-api-key.png

Enable Schedule this sequence.

schedule-data-fetcher-request.png

Select how often you want the request to run, e.g. 'Every hour'. Click 'Save' The sequence will now run on the schedule and update the exchange rates automatically.

schedule-save.png