How to connect the Hubspot API to Google Sheets using Apipheny

HubSpot offers a broad range of marketing, sales, and customer service software that works together with their core CRM product. Their various packages and platforms feature a significant degree of interoperability, creating a powerful business-focused ecosystem.

In this tutorial, you’ll learn how to connect the Hubspot REST API to Google Sheets in 5 steps using the Apipheny add-on:

  1. Install the Apipheny Add-on
  2. Get your Hubspot API Key
  3. Choose a Hubspot Endpoint URL
  4. Enter the Hubspot API Request into Apipheny
  5. Run the Hubspot API Request

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

To pull data from the Hubspot API to Google Sheets, you’ll have to 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. Click here for more information about Apipheny on the homepage. There’s a 30-day free trial included, then it’s $19-$29/month.

1. Install Apipheny by opening the following link in on desktop and then clicking the Install button on the page: https://gsuite.google.com/marketplace/app/apipheny/966163326746

Install Apipheny
Install Apipheny

2. After you’ve installed Apipheny, open a Google Sheet and then click on the Add-Ons 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
Open Apipheny

Step 2.) Get your Hubspot API Key

1. In your HubSpot account, click the Settings icon in the main navigation bar:

Click Settings
Click Settings

2. In the left sidebar menu, navigate to Integrations > API key:

Go to Integrations > API key
Go to Integrations > API key

3. If a key has never been generated for your account, click the Create key button:

Create Hubspot API key
Create Hubspot API key

Copy the key somewhere safe because you will need it in the next steps.

If you’ve already generated an API key, you can click Show to display your key:

Show Hubspot API key
Show Hubspot API key

Step 3.) Obtain a Hubspot Endpoint URL

In this section, we’ll show you how to browse the Hubspot API documentation to obtain an API Endpoint URL that retrieves the specific information you need from your Hubspot account.

If you already know your URL, or you want to use the same example URL as us, just skip to Step 4.

First, open the Hubspot API documentation page: https://developers.hubspot.com/docs/v2/overview

The menu on the left contains a list of the available APIs each with its own endpoints.

Clicking on an API scrolls to that API’s section, containing a list of associated endpoints. For instance, the Contacts List API scrolls to the list of its 12 endpoints: Create a contact list, Get contact lists, all the way to Remove contact from a list:

Hubspot Contact Lists API (example)
Hubspot Contact Lists API (example)

All API calls to HubSpot should be made to the https://api.hubapi.com root domain:

https://api.hubapi.com

One of the available endpoints, the one we’re using in this example, is Get contact lists:

https://api.hubapi.com/contacts/v1/lists?count=<number of contacts>&hapikey=<API Key>

Its’ documentation contains a short description, the HTTP method used (GET) and the link you should append to the root domain for querying this endpoint (/contacts/v1/lists):

Hubspot API Documentation
Hubspot API Documentation

For endpoints that accept parameters, this documentation is where you would find them listed and explained, along with example inputs and responses.

Step 4.) Enter the Hubspot API URL 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 3, we explained how you can find the Hubspot REST API endpoint that you need. Now copy the complete URL (root domain + endpoint) into the Apipheny add-on, where it says API URL Path, followed by any GET parameters required for your query.

For this example, we are using the Get all contacts API endpoint, to get all contacts:

https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=<your API key>

<your API key> is where you enter the API key that we got in step 3. Do not include the carrots “<>”.

Headers are not required for this request.

Hubspot API request entered in Apipheny
Hubspot API request entered in Apipheny

Step 5.) Run the Hubspot API Request

Click the Run button at the bottom of the Apipheny add-on and then wait for the Hubspot API data to be added to your Google Sheet:

Hubspot API data in Google Sheets
Hubspot API data in Google Sheets

After making a successful request to the Hubspot API, try querying a different endpoint, or try using one of the more advanced features in the Apipheny add-on, such as:

  • Save and schedule your API request
  • Make a POST request (if available)
  • Use the custom =APIPHENY() function to call the API request inside your spreadsheet
  • Create an API request by referencing the value of a cell in the API URL with three curly braces eg. {{{Sheet1!A1}}}

Related articles:

Related Posts

Leave a Comment