Your Uncommonly Amazing WordPress Tech Partner
Membership plugins

How to send data from GravityForms to Google Sheets

gf to google sheets

[et_pb_section fb_built=”1″ _builder_version=”3.23.3″ custom_padding=”5px|||||”][et_pb_row _builder_version=”3.25″ background_size=”initial” background_position=”top_left” background_repeat=”repeat” custom_padding=”5px|||||”][et_pb_column type=”4_4″ _builder_version=”3.25″ custom_padding=”|||” custom_padding__hover=”|||”][et_pb_text _builder_version=”4.4.6″ z_index_tablet=”500″]

Want to send your Gravity Forms submissions data to Google Sheets?

This article will show you a unique method for doing so that doesn't rely on Zapier or other external services. 🙂

This is useful if you want to track orders, edit applications, or simply manage and share you form submissions data to a Google Sheet.

What you will need

1 – The GravityForms Plugin.

2 – Forms: 3rd Party Integration 

Install and activate this plugin.

(You can use this free plugin to send your data to almost all third-party APIs in Gravity Forms.)

3 – Script for Google Sheet (explained below).

Create Your Google Sheet

Add a header row.

Note: Don't change the header row at any point afterwards.

Screenshot 1 - How to send data from GravityForms to Google Sheets

Create New Script

Go to Tools->Script editor…

Screenshot 2 - How to send data from GravityForms to Google Sheets

Add Script

Delete any data that is in the Script and copy and paste the script below instead:

function doPost(e) {   if (!e) return;   var sheetID = "GOOGLE_SPREADSHEET_ID";  // Replace this with the Google Spreadsheet ID  var sheetName = "Sheet1";       // Replace this with the sheet name inside the Spreadsheet   var status = {};   // Code based on Martin Hawksey (@mhawksey)'s snippet   var lock = LockService.getScriptLock();  lock.waitLock(30000);   try {     var sheet = SpreadsheetApp.openById(sheetID).getSheetByName(sheetName);    var headers = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues()[0];     // Add the data and time when the Gravity Form was submitted    var column, row = [],      input = {        "timestamp": new Date()      };     for (var keys in e.parameter) {      input[normalize_(keys)] = e.parameter[keys];    }     for (i in headers) {      column = normalize_(headers[i])      row.push(input[column] || "");    }     if (row.length) {       sheet.appendRow(row);      status = {        result: "success",        message: "Row added at position " + sheet.getLastRow()      };     } else {      status = {        result: "error",        message: "No data was entered"      };    }   } catch (e) {     status = {      result: "error",      message: e.toString()    };   } finally {     lock.releaseLock();   }   return ContentService    .createTextOutput(JSON.stringify(status))    .setMimeType(ContentService.MimeType.JSON); } function normalize_(str) {  return str.replace(/[^\w]/g, "").toLowerCase();}

Be sure to replace the sheet ID and the sheet name.

The spreadsheet ID is the long sequence of characters between the slashes in the URL of the desired spreadsheet:

Screenshot 3 - How to send data from GravityForms to Google Sheets

Save Script

Save your script by clicking File > Save , and give your script a name.

Screenshot 4 - How to send data from GravityForms to Google Sheets

Run Script

Run the script by pressing the Play button icon in the menu.

A permission box should pop up, click continue and then allow.

Screenshot 5 - How to send data from GravityForms to Google Sheets Screenshot 6 - How to send data from GravityForms to Google Sheets

Deploy the script

Deploy the script as a Web App by clicking on Publish > Deploy as web app

1 – Project Version: Leave default or enter 1.0.0

2 – Execute the app as: Myself

3 – Who has access to the app: Anyone, even anonymous

4 – Click Deploy

5 – And then Copy the current web app URL from the confirmation screen.

This is now your API URL to use in the Post to 3rd Party API for Gravity forms.

Screenshot 7 - How to send data from GravityForms to Google SheetsScreenshot 8 - How to send data from GravityForms to Google SheetsScreenshot 9 - How to send data from GravityForms to Google Sheets

Create and set new Gravity Form

Create a new “Send to Third Party” feed for your GravityForms form by going to Forms > Your Form > Settings > Send to Third Party > Add New

Use the following settings.

Name: Any Name you choose

Method: POST

API URL: Paste the URL that you copied from the Google Script Web App

Authorization: None

Headers: Leave Blank

Format: Default

Map API Parameters to Form Fields:

In the first column, enter the column titles from your google sheet, they must match exactly. Select which form field you want mapped to that column in your google sheet via the dropdown.

Conditional Logic: Optional – you can add conditional login to this connection in order to limit which form entries get sent to your google sheet.

Now save the feed and submit a test form to see it work.

Screenshot 11 - How to send data from GravityForms to Google Sheets

Submit the form.

After submitting data will appear in your spreadsheet.

Screenshot 12 - How to send data from GravityForms to Google Sheets Screenshot 13 - How to send data from GravityForms to Google Sheets

As you can see, you can send data from GravityForms to Google Sheets in 10-15 minutes without having to spend any of your zaps or map fields in Zapier!

Video: Sending GravityForms Submissions to a Google Spreadsheet

Here's the video version of this tutorial!

[/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section]

You may also enjoy...

WordPress based membership sites have certain requirements, and make use of certain applications that, in my experience, makes most of the popular hosting providers a poor choice.
Want to learn 7 simple steps to launch your very own affiliate program QUICKLY, with minimal effort and monetary investment? Click to read…

Case Study for a MemberPress Migration Recovery 👉 This case study highlights how MemberFix rescued WOWintl.org from a broken migration, restored member trust, and set the foundation for long-term growth.

Learn when it makes sense to use WordPress page builders (Elementor, Divi, etc.) versus custom page templates, and the pros and cons of each!

31 Responses

  1. Hello, Thanks for the article! My individual form settings don’t show the “Send to Third Party” like your screenshot does. They show under gravity settings, but the form fields don’t auto populate.

  2. I have the same problem where the Gravity Form does not show the 3rd part services item on its settings menu. I did install the recommended plugin in your post. Can you help figure this out please?

  3. Hello, I have the same issue as the other comments: the Send to Third Party option isn’t showing up on the Gravity Forms settings. Thank you

  4. Hello, I have the same issue as the other comments: the Send to Third Party option isn’t showing up on the Gravity Forms settings. Thank you

  5. Can you cover on how to set up the 3rd Party Integration plugin?
    Nothing I have done is getting it show up in the settings of my GF either.

    Thank you for the great video.. 🙂

  6. I was able to get everything up and running but the data is not showing up on the Sheets side. Any suggestions for trouble shooting?
     
    Thanks for creating this!

    Rob
     

  7. I keep getting an error when trying to save and test the script. Anyone else having the same problem?
    Missing ; before statement

  8. Greetings. I have an issue regarding the entry date & time. When I submit the form in website, the time is 2020-07-29 11:29 but in the entry inside Google Sheet it is shown 2020-07-29 03:29 which is 3 hours difference. I have checked the timezone settings for both WordPress & Google Sheet, both is the correct one which is GMT +8:00 Kuala Lumpur. Does anyone else have the same issue like this or can help me regarding this? Thank you very much!

    1. Is there a way to set multiple sheets?

      My site has multiple forms and I want to configure it to save the entries to a specific sheet# on the file and using the same script

      Example:

      Form 1
      Data will be added to Sheet 1

      Form 2
      Data will be added to Sheet 2

      is this possible?

      1. Hi, I have everything working and wanted to thank you. I am running into an issue where the list field in Gravity Forms sends the data like so: [{“Event”:”heart surgery”,”Date”:”May 2020″}]. I am wondering if there is a way to remove the formatting as I am grabbing the data or should i try and figure a way to filter in Google sheets? Thank you for your time.

  9. Hi, thank you for this tutorial.
    I am not able to see data being pushed to Google Sheets. I have tried many times but the push is still not working.

Leave a Reply

Your email address will not be published. Required fields are marked *