Gravity Forms is an easy to use WordPress plugin that makes it easy to create custom forms on your WordPress website.

In this tutorial, you will learn how to connect the Gravity Forms REST API to Google Sheets in 5 steps:

  1. Install the Apipheny Add-on
  2. Generate a Gravity Forms API key
  3. Choose your Gravity Forms endpoint
  4. Enter your Gravity Forms API request into Apipheny
  5. Run the Gravity Forms API request in your Google Sheet

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

To pull data from the Gravity Forms API into 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. Click here for more info about Apipheny.

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

Install the Apipheny add-on to connect Gravity Forms to Google Sheets
Install the Apipheny add-on to connect Gravity Forms to Google Sheets

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 the Apipheny add-on to connect the Gravity Forms API
Open the Apipheny add-on to connect the Gravity Forms API

Step 2.) Generate an Gravity Forms API key

In your WordPress dashboard, navigate to Forms:

Click "Forms" in the Gravity Forms menu of your WordPress site
Click “Forms” in your WordPress site

Under Forms, click the Settings menu item:

Go to your Gravity Forms settings
Go to your Gravity Forms settings

Click Rest API, then check the Enabled checkbox:

Enable the Rest API in your Gravity Forms settings
Enable the Rest API in your Gravity Forms settings

After you’ve enabled the API access, click the Add Key button to generate an API key:

Generate your Gravity Forms API key
Generate your Gravity Forms API key

Complete the key description, set permissions, and then click the Add Key button:

Complete the process by clicking "Add Key"
Complete the process by clicking “Add Key”

Your key is now generated, along with a secret value. Copy and paste both of these values to a safe location, because they will no longer be available once you leave this page and you will need them in the next steps:

Copy and paste your key and secret to a safe location for use in the later steps
Copy and paste your key and secret to a safe location for use in the later steps

Step 3.) Choose a Gravity Forms Endpoint URL

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

First, open the Gravity Forms API documentation page: https://docs.gravityforms.com/rest-api-v2/

The menu on the left contains links to the Getting Started, User Guides, Your Gravity Forms Account, Developers and Knowledge Base sections. If you click the Developers section, you’ll find the Rest API v2 Guide:

Gravity Forms API documentation
Gravity Forms API documentation

If you scroll down, you’ll find the Endpoints section. Click the Endpoints link to display available endpoints for this API:

Gravity Forms API endpoints
Gravity Forms API endpoints
Gravity Forms API endpoint documentation example
Gravity Forms API endpoint documentation example

All API calls to Gravity Forms should be made to this base URL: https://localhost/wp-json/gf/v2/

localhost” must be replaced with your domain name.

An example endpoint is GET /entries/[ENTRY_ID], and this is what the API URL looks like put together:

https://localhost/wp-json/gf/v2/entries/

Each endpoint’s documentation contains its HTTP method (GET), its path structure, a short description of the endpoint’s purpose, its complete path, an example response and the list of its required/optional properties.

Gravity Forms API endpoint documentation example
Gravity Forms API endpoint documentation example

Step 4.) Enter your Gravity Forms API request into Apipheny

Now go back to your Google Sheet and make sure that the Apipheny add-on is open to 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 GravityForms REST API endpoint that you need. Now copy and paste your complete GravityFormsAPI URL into the Apipheny add-on, where it says API URL Path, followed by any GET parameters required for your query (if applicable).

For this example, we are using the Entries endpoint, that gets all entries. This is what the whole URL looks like:

https://localhost/wp-json/gf/v2/entries

If you are following the same example as us, you can copy and paste this URL into Apipheny, but don’t forget to replace “localhost” with your domain name.

Headers: In the Headers section of the Apipheny add-on, add two rows with the following keys and values:

Header 1
Key:
Authorization
Value:
Basic <base64_encoding>

Header 2
Key:
Content-Type
Value:
Application/json

For the value of the first header, you’re going to need to replace <base64_encoding> with a base64 encoded version of your API key and secret. You can do that by entering your key and secret like this: “consumer_key:consumer_secret” into this website: https://www.base64encode.org/. Do not add the quotation signs (“) in the encoding site.

Consumer_key and consumer_secret are the values that you previously obtained in Step 2.

Don’t forget to put the word “Basic” before your encoded value. There should be a space between “Basic” and <base64_encoding>.

Here’s what your API request should look like when entered into Apipheny, if you’re following the same example as us:

Gravity Forms API request entered into Apipheny
Gravity Forms API request entered into Apipheny

Step 5.) Run the Gravity Forms API Request

Finally, the last step is to click the Run button at the bottom of the Apipheny add-on and then wait for the Gravity Forms API data to be imported into your Google Sheet.

Gravity Forms data in Google Sheets
Gravity Forms data in Google Sheets

That’s it! You’ve successfully integrated Gravity Forms with Google Sheets.

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

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

Related articles:

Learn More:

Related Posts