Skip to main content

Pro Feature

How to Automatically Save Contact Form 7 Submissions to Google Sheets

Learn how to automatically add Contact Form 7 (CF7) submissions as new rows in Google Sheets. This guide covers a no-code, settings-only approach as well as a manual implementation using Google Apps Script, including common pitfalls to watch for.

If you want to aggregate and share inquiry content, the easiest approach is to automatically save Contact Form 7 (CF7) submissions to Google Sheets. A new row is added with every submission, so you can immediately aggregate, chart, and share the data with your team. This article covers both a no-code approach that’s done entirely in the settings screen, and a manual implementation where you write the code yourself.

Why saving to a spreadsheet is convenient

With email notifications alone, it’s a hassle to later pull together numbers like “how many inquiries this month” or “a breakdown by category.” If you accumulate submissions in a spreadsheet, you can instantly analyze them with filters, pivot tables, and charts. Sharing with sales or management is also as simple as sending a single link.

You can implement saving to Google Sheets using only the WordPress admin settings, without writing any functions.php or Google Apps Script code. Using Frontierline Forms’ integration feature, you can finish in the following 4 steps. There’s no need to worry about getting stuck on deployment or permission settings.

This procedure is a Pro feature of Frontierline Forms (Slack / Chatwork / Google Sheets notifications).

Steps

  1. Prepare a destination sheet: Prepare a spreadsheet with headers (date/time, name, email, message, etc.) in the first row.
  2. Set up the integration: Select Google Sheets in the plugin’s integration settings and follow the prompts to connect your destination sheet.
  3. Map the fields: Map form fields to spreadsheet columns directly in the settings screen, with no coding required.
  4. Send a test submission: Submit the form and confirm that a row is added with values in each column.

Even if you modify the form later, the column mapping rarely breaks, so management stays manageable across multiple forms and multiple sites.

Method 2: Manual implementation with Google Apps Script (for advanced users)

If you want to write the code yourself, you can implement this by using a Google Apps Script (GAS) web app as CF7’s submission destination.

Prepare the destination sheet and GAS

Create a spreadsheet and add headers (date/time, name, email, message) in the first row. Open Extensions → Apps Script and write a web app like the following.

function doPost(e) {
  const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];
  const p = e.parameter;
  sheet.appendRow([new Date(), p['your-name'], p['your-email'], p['your-message']]);
  return ContentService.createTextOutput('ok');
}

Select “Deploy → New deployment → Type: Web app,” set access to “Anyone,” and deploy. The issued URL, https://script.google.com/macros/s/.../exec, is your endpoint.

Sending from the WordPress side

Use CF7’s wpcf7_mail_sent hook to POST the submission data to this URL.

add_action('wpcf7_mail_sent', function ($form) {
  $submission = WPCF7_Submission::get_instance();
  $data = $submission ? $submission->get_posted_data() : [];
  wp_remote_post('https://script.google.com/macros/s/XXXX/exec', [
    'body' => [
      'your-name'    => $data['your-name'] ?? '',
      'your-email'   => $data['your-email'] ?? '',
      'your-message' => $data['your-message'] ?? '',
    ],
  ]);
});

Pitfalls with the manual implementation

  • Deployment settings are confusing: If you forget to set access permissions to “Anyone,” you’ll get a 403 error and nothing will be saved. Some setups also change the URL every time you redeploy.
  • Mismatched field names leave cells blank: If the form field names and the GAS-side keys don’t match, rows will be added but the columns will stay empty.
  • Maintenance is split across the theme and GAS: You need to maintain both the WordPress-side code and the GAS-side script, which can easily become dependent on a single person.

A simple save can be built manually, but you’re likely to run into trouble with deployment, permissions, and field mapping, and maintenance ends up duplicated. That’s exactly why Method 1, which is done entirely through settings, is the more practical choice.

Choosing between spreadsheet storage and database storage

SpreadsheetPlugin’s database storage
Aggregation & chartingStrongRequires separate export
Team sharingEasy via a linkRequires admin login
Count & permission managementWeakCentralized in the admin screen
Bulk CSV exportManualOne-click export of all records

The two aren’t mutually exclusive. Sharing and analyzing via a spreadsheet while also saving every submission to the database on the site lets you cover both thorough record-keeping and analysis. For database storage of submission logs and CSV export, see the feature list on the product page.

Summary

Since CF7 alone has no built-in Google Sheets integration, you’ll need to either configure an integration-capable plugin or build it yourself with GAS. If you’re managing multiple projects, the settings-only approach is faster and avoids deployment pitfalls. Method 1 is the recommended starting point.

If you want to set up Google Sheets integration along with Slack and Chatwork notifications, database storage of submission logs, and full CSV export, all through settings alone, consider adopting Frontierline Forms.

Frontierline Forms

This setup takes just a checkbox in the admin.

Add alerts, submission logging, CSV export and multi-step forms without writing code — all from the settings screen. The 5-site / unlimited license lets agencies cover form maintenance across many client projects at once. Your license key is issued instantly on payment.

See pricing & buy → Feature details