Print

Import Google Business Profile Data to Google Sheets

In this guide, we’ll walk through how to pull Google Business Profile (aka Google My Business) API data directly into Google Sheets, using the API Connector add-on for Sheets.

Contents

Before You Begin

Click here to install the API Connector add-on from the Google Marketplace.

Part 1: Connect to the Google Business Profile API

The easiest way to get started with the Google Business Profile API is through API Connector's built-in integration.

  1. In Sheets, open API Connector and create a new request (Extensions > API Connector > Open > Create request)
  2. Select Google Business from the drop-down list of applications
    googlebusiness-application
  3. Under Authorization, click Connect to Google My Business
    googlebusiness-authorization
  4. You will be directed to google.com and asked to allow Mixed Analytics to access your Google business listings. Click Allow.
    googlebusiness-allow
  5. You'll then be returned to your Google Sheet, and can verify that your Google Business connection is active in the Connections screen.

Part 2: Pull Google Business API Data into Sheets

Now that we’re connected, let’s pull some data into Sheets. We'll first fetch the IDs we need for subsequent requests.

Request #1 - account IDs

For this first example, you'll fetch the account IDs to which you have access.

  1. Select the /v1/accounts/ endpoint.
    googlebusiness-endpointaccounts
  2. In the "Path parameters" section, set the subdomain parameter to mybusinessaccountmanagement. This is the required subdomain for this endpoint, so there are no other options.
  3. Optionally add a filter or change the pageSize parameter.
  4. Choose a destination sheet, name your request, and hit Run. A moment later you'll see the response data in your sheet.
    googlebusiness-response1
  5. Note the numeric value located in the accounts.name field, after "accounts/". This is your account ID, which you'll use in the next request.

Request #2 - location IDs

In this next example, we'll get the business location ID, hours, and other data.

  1. Select the /v1/accounts/{account_id}/locations endpoint
    googlebusiness-endpointlocations
  2. In the "Path parameters" section, populate the account_id parameter with the account ID you retrieved in the first request. Also set the subdomain parameter to mybusinessbusinessinformation (again, this is the only option).
  3. In the "Request parameters" section, use the readMask parameter to select the fields you'd like to see in your report. This is required.
  4. Optionally set other parameters, e.g. filters and sort.
  5. Choose a destination sheet, name your request, and hit Run. A moment later you'll see the location response data in your sheet.
    googlebusiness-response2
  6. As before note the numeric ID. This is your location ID, which you'll use in most subsequent requests.

You can now plug the account and location IDs into the other available endpoints to fetch performance metrics and business reviews.

Part 3: Create a Custom API Request

Alternatively, you can create a custom request instead of using API Connector’s built-in integration, using any of the endpoints and parameters shown in the API documentation. Here's an example request setup:

  1. Open up Google Sheets and click Extensions > API Connector > Open > Create request.
  2. In the request form enter the following, substituting in your own location ID where it says your_location_id:
    • ApplicationCustom
    • MethodGET
    • Request URLhttps://businessprofileperformance.googleapis.com/v1/locations/your_location_id:fetchMultiDailyMetricsTimeSeries?dailyMetrics=WEBSITE_CLICKS&dailyMetrics=CALL_CLICKS&dailyRange.start_date.year=2023&dailyRange.start_date.month=1&dailyRange.start_date.day=1&dailyRange.end_date.year=2023&dailyRange.end_date.month=10&dailyRange.end_date.day=31
    • OAuth: Google My Business
  3. Create a new tab and click Set current to use that tab as your data destination.
  4. Name your request and click Run.

Part 4: Handle Pagination

By default, the Google Business API will limit records returned in the response. To get more records, set the pageSize parameter to 50 or 100 as shown in the examples above (different endpoints have different pageSize limits).

If you need more records after that, you can loop through them using pagination handling:

  • Pagination typecursor
  • Next token parameterpageToken
  • Next token pathnextPageToken
  • Run untilchoose when to stop running the request
    googlemybusiness-pagination

Part 5: API Documentation

Official API documentation: https://developers.google.com/my-business/reference/rest

Leave a Comment

Jump To