This article describes a different method than Zapier or other external services for sending your Gravity Form applications to Google Sheet. This is useful if you want to track orders, edit applications, or simply manage and share sent data to Google Sheet. You can use the free Gravity Forms Post plugin for third-party APIs to send your data to almost all third-party APIs in Gravity Forms.

What you will need

1 – The GravityForms Plugin.

2 – A 3rd party API plugin – Forms: 3rd Party Integration 

3 – Script for Google Sheet (explained below).

Create Google spreadsheet

Add a header row. Don’t change it after.

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 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 tutorial

Here’s the video version of this tutorial!

Share This