FormRill
  1. Blog

Send form submissions to Google Sheets without Zapier

A spreadsheet is still the easiest CRM there is. This guide sends every submission from your website form into a Google Sheet as a new row, with no Zapier account and no per-task fees. It takes about ten minutes, and you only paste code once.

By FormRill team2 min read

What you need: a Google account, and a FormRill form. Google Sheets is a Pro feature, free during the beta ($9/month after launch).

How it works

Google Sheets can’t receive data from a website on its own, but a tiny Google Apps Script attached to the sheet can. You publish that script as a “web app”, which gives it a private URL. FormRill sends each submission to that URL, and the script adds the row.

1. Create the sheet

Open a new Google Sheet and give it a name, such as “Website leads”. Leave it empty; the script writes the column headings for you.

2. Add the script

From the sheet’s menu, open Extensions → Apps Script. Delete whatever is in the editor and paste this:

// Adds one row per FormRill submission. New fields become new columns.
function doPost(e) {
  const lock = LockService.getScriptLock()
  lock.waitLock(10000) // two submissions at once won't overwrite each other

  try {
    const body = JSON.parse(e.postData.contents)
    const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0]
    const row = {
      submitted_at: new Date(body.created_at),
      form: body.form_name,
      ...body.data,
    }

    const headers = sheet.getLastColumn()
      ? sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues()[0]
      : []
    for (const key of Object.keys(row)) {
      if (!headers.includes(key)) {
        headers.push(key)
        sheet.getRange(1, headers.length).setValue(key)
      }
    }

    sheet.appendRow(headers.map((h) => row[h] ?? ''))
    return ContentService.createTextOutput('ok')
  } finally {
    lock.releaseLock()
  }
}

Click Save.

3. Publish it as a web app

  1. Click Deploy → New deployment.
  2. Choose the type Web app.
  3. Set Execute as to yourself, and Who has access to Anyone. FormRill has no Google account, so it needs this to reach the script.
  4. Click Deploy and approve the permissions Google asks for. It’s your own script asking to edit your own sheet.
  5. Copy the Web app URL. It starts with https://script.google.com/macros/s/ and ends in /exec.

Keep that URL private: anyone with it can add rows to your sheet.

4. Connect it in FormRill

In your form’s Automations tab, choose Google Sheets, paste the web app URL and add it. Your email notifications keep working alongside it.

5. Test

Submit your form once. Within a few seconds the sheet gets a heading row and your first submission: when it arrived, the form name, then one column per field. A field you add to the form later simply becomes a new column.

Troubleshooting

Why not Zapier?

Zapier and similar tools work, but they bill per task and add another account to the chain. Here the only moving parts are your form, FormRill and your own sheet, and a failed delivery is logged and retryable instead of disappearing into a task history.

Start sending submissions to Sheets

Free up to 500 submissions a month and unlimited forms. No server, no credit card.

Start free

Related