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:
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
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.
In your WordPress dashboard, navigate to Forms:
Under Forms, click the Settings menu item:
Click Rest API, then check the Enabled checkbox:
After you’ve enabled the API access, click the Add Key button to generate an API key:
Complete the key description, set permissions, and then click the Add Key button:
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:
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:
If you scroll down, you’ll find the Endpoints section. Click the Endpoints link to display available endpoints for this API:
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:
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.
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:
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:
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.
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: