Google Sheets Setup
Connect your Google Sheet to receive WordPress form submissions with SheetLinkWP - one-click Google connect or the classic Apps Script webhook.
Overview
SheetLink Forms offers two ways to connect Google Sheets. Both are free:
- One-click connect (recommended, v1.12.0+) - sign in with Google and pick your spreadsheet. Takes about a minute, no code.
- Classic Apps Script webhook - deploy a small script on your own sheet and paste its URL into SheetLink. Fully self-hosted: submissions travel from WordPress to your own Apps Script, with no OAuth and no SheetLink-run service in the path.
Pick whichever fits your setup. The classic method has two setup routes (copy our template, or paste the script manually), both covered below.
Method 1: One-Click Connect (Recommended)
One-click connect links a sheet without deploying any code. Since v1.14.0 you do not set up columns yourself - your form defines them:
- In your WordPress admin, go to SheetLink -> Google Sheets (OAuth) (the setup wizard also offers a Connect Google (one click) card)
- Click Connect Google and approve the standard Google consent screen
- In the Google file picker, select an existing spreadsheet or create a new one
- Add a sync rule pointing a form at this sheet. If you have no rules yet, the Google Sheets screen offers to create one right there - pick your form plugin and you are done
- Submit the form once. SheetLink writes the header row from that form's own fields and adds the submission underneath
drive.file scope, so SheetLink can only see and write to the spreadsheets you picked or created - never the rest of your Drive.Classic Method A: Copy Template
Click the button below to create a copy of our template sheet. The Apps Script is already included - no code to paste.
This creates a copy of our template sheet with the Apps Script already included.
After copying, go to Extensions > Apps Script to verify the code is there. Then proceed to Deploy as Web App below.
Classic Method B: Manual Setup
- Create a new Google Sheet (or open an existing one)
- Go to Extensions > Apps Script
- Delete any existing code in
Code.gs - Paste the following script:
function doPost(e) {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var data = JSON.parse(e.postData.contents);
// Create header row on first submission
if (sheet.getLastRow() === 0) {
sheet.appendRow(Object.keys(data));
}
// Get current headers
var lastCol = sheet.getLastColumn();
var headers = lastCol > 0
? sheet.getRange(1, 1, 1, lastCol).getValues()[0]
: [];
// Auto-add columns for any new fields
var keys = Object.keys(data);
for (var i = 0; i < keys.length; i++) {
if (headers.indexOf(keys[i]) === -1) {
headers.push(keys[i]);
sheet.getRange(1, headers.length).setValue(keys[i]);
}
}
// Build row in header order
var row = headers.map(function(h) { return data[h] || ''; });
sheet.appendRow(row);
return ContentService.createTextOutput(
JSON.stringify({ status: 'ok' })
).setMimeType(ContentService.MimeType.JSON);
}
// Run this to verify the script works
function testDoPost() {
doPost({ postData: { contents: JSON.stringify({
timestamp: new Date().toLocaleString(),
name: 'Test User',
email: 'test@example.com',
message: 'Hello from SheetLinkWP!'
})}});
Logger.log('Test row added!');
}
Save the script (Ctrl+S / Cmd+S), then proceed to deploy it below.
Deploy as Web App
Classic Apps Script method only. Whether you used the template or pasted the script manually, you need to deploy it as a web app to get a URL that SheetLinkWP can send data to.
- In the Apps Script editor, click Deploy > New deployment
- Click the gear icon next to "Select type" and choose Web app
- Set Description to anything (e.g., "SheetLinkWP Receiver")
- Set "Execute as" to Me
- Set "Who has access" to Anyone
- Click Deploy
- Authorize the script when prompted (click through the "unsafe" warning - this is your own script running under your account)
- Copy the Web app URL - it looks like
https://script.google.com/macros/s/.../exec - Paste this URL into SheetLinkWP's "Receiver URL" field
/exec (not /dev). The /dev URL is for testing only and won't accept external POST requests.Re-deploying After Changes
If you edit the Apps Script code, you must create a new deployment version for changes to take effect.
- Go to Deploy > Manage deployments
- Click the Edit (pencil) icon
- Change Version to "New version"
- Click Deploy
The URL stays the same - no need to update it in SheetLinkWP.
Multiple Tabs
Each sync rule gets its own tab. A tab has a single header row, so two forms with different fields cannot share one - the first rule uses the tab you picked when connecting, and every additional form gets its own tab named after the rule. SheetLink creates it on that form's first submission.
To route submissions from a single form to different tabs based on the answers, use Conditional Routing. When routing rules match, the tab name is sent as part of the payload.
See Conditional Routing for setup details.
Troubleshooting
doPost (case-sensitive). Check that you pasted the code into Code.gs, not a different file./exec URL, not the /dev URL. The /dev endpoint doesn't accept external requests.For more help, see the full Troubleshooting Guide.
Ready to Get Started?
Install SheetLink Forms and connect your first form in under 10 minutes.