Integrating n8n with Google Sheets lets you automate tasks like adding, updating, or reading spreadsheet data. Here's a step-by-step guide to help you set up the integration:
โ
Prerequisites
- An active n8n instance (self-hosted or cloud).
- A Google account with access to Google Sheets.
- Create a Google Cloud Project and enable the Google Sheets API.
๐ง Step 1: Create Google API Credentials
Go to the Google Cloud Console.
Create a new project or select an existing one.
Navigate to APIs & Services > Library, search for Google Sheets API, and enable it.
Go to APIs & Services > Credentials.
Click Create Credentials > OAuth 2.0 Client ID.
Choose Web application.
Add the redirect URL:
https://api.n8n.cloud/oauth2-credential/callback
(Or use your own n8n URL like https://yourdomain.com/oauth2-credential/callback if self-hosted.)
Save your Client ID and Client Secret.
๐ Step 2: Add Google Sheets Credentials in n8n
- In n8n, go to Credentials > Google Sheets OAuth2 API.
- Click "New Credential".
- Paste your Client ID and Client Secret.
- Click Connect OAuth2 Account โ this will open a Google login window.
- Authorize access to your Google Sheets.
๐ Step 3: Build Your Workflow
Now you can create a workflow that uses Google Sheets.
Example: Add a new row to a Google Sheet
Trigger Node: Choose a trigger like Webhook or Cron.
Google Sheets Node:
Operation: Append
Sheet ID: Paste the Google Sheet ID (from URL).
Range: Example: Sheet1!A:C
Values: Set the data for each column (e.g., Name, Email, Date).
โ
You can map data from previous nodes using expressions like:
{{$json["name"]}}
{{$json["email"]}}
{{$now}}
๐งช Tips for Success
- Your sheet must be shared with the Google account used in OAuth.
- Sheet headers should match your data columns.
- Use
Set node before Google Sheets node to structure your data clearly.
๐ Common Use Cases
| Use Case | Description |
| ----------------------- | ---------------------------------------------------- |
| Log form submissions | Capture Typeform/Google Form submissions into Sheets |
| Sync CRM leads | Push new leads from Hubspot or Pipedrive to Sheets |
| Reporting | Auto-generate daily reports with Cron + Sheet nodes |
| Email parsing to Sheets | Parse emails and append data into Google Sheets |
Here's a basic n8n workflow JSON that appends data to a Google Sheet. It includes a Webhook trigger, a Set node for data formatting, and a Google Sheets node to write the data.
๐ Workflow: "Append Data to Google Sheet via Webhook"
๐ง What it does:
- Listens for an HTTP POST request (e.g., from a form).
- Extracts
name and email from the payload.
- Appends the data to
Sheet1 of your Google Sheet.
๐ฝ JSON Workflow (copy this and import into n8n):
{
"nodes": [
{
"id": "webhook-trigger",
"name": "Webhook Trigger",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [200, 300],
"parameters": {
"httpMethod": "POST",
"path": "append-to-sheet",
"responseMode": "onReceived"
}
},
{
"id": "set-data",
"name": "Set Data",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [400, 300],
"parameters": {
"fields": {
"name": "={{$json.body.name}}",
"email": "={{$json.body.email}}",
"timestamp": "={{$now}}"
}
}
},
{
"id": "google-sheets",
"name": "Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 3,
"position": [600, 300],
"parameters": {
"operation": "append",
"sheetId": "YOUR_SHEET_ID_HERE",
"range": "Sheet1!A:C",
"valueInputMode": "USER_ENTERED",
"options": {}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "YOUR_CREDENTIAL_ID",
"name": "Google Sheets OAuth2"
}
}
}
],
"connections": {
"Webhook Trigger": {
"main": [
[
{
"node": "Set Data",
"type": "main",
"index": 0
}
]
]
},
"Set Data": {
"main": [
[
{
"node": "Google Sheets",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {},
"name": "Append to Google Sheet",
"version": 1
}
๐ How to Use:
Replace YOUR_SHEET_ID_HERE with your actual Google Sheet ID (from the URL).
Replace YOUR_CREDENTIAL_ID with the ID of your created Google Sheets credential in n8n.
Make sure your Google Sheet has the headers: name, email, timestamp.
Deploy the workflow.
Send a POST request to:
https://your-n8n-domain/webhook/append-to-sheet
With JSON body:
{
"name": "Alice",
"email": "alice@example.com"
}
Would you like me to generate a Google Sheet template for testing or help with setting up a form to trigger this?