Platform
Chatbot Builder Bulk Messaging Team Inbox Mini CRM API & Webhooks AI Integration WhatsApp Flows
Industries
E-commerce & D2C Real Estate Education Healthcare Finance & BFSI Logistics Hospitality Retail
Integrations
Learn
Learning Hub Help & Docs Connect Guides Automation Codex Blog Message Templates
Pricing Start Free Trial →
HomeConnect › Connect Google Sheets to WhatsApp
Google Sheets Integration Guide · Forms / Productivity

Connect Google Sheets to WhatsApp

Log every WhatsApp lead, order, or survey answer to a Google Sheet automatically. No more copy-pasting from chats: when something happens on WhatsApp, a new row appears in your spreadsheet in real time.

Published 23 June 2026  ·  8 min read  ·  Forms / Productivity

Before following this guide, read the External API Request step foundation guide. It covers every field in the step interface so this guide can focus on the Google Sheets specifics.

Two methods: pick based on your comfort level

Method 1 (recommended): Apps Script webhook. Paste a short script into your sheet, deploy it as a web app, and post to its URL. No OAuth, no service account, no API key. Method 2: direct Sheets API. Use Google's official append endpoint with a service account token. More setup, but no script in your sheet. Most WhatsApp users should choose Method 1.

Method 1: Apps Script webhook (recommended)

This method turns your Google Sheet into a webhook that accepts a POST request and appends a row. It runs under your own Google account, so there is no token exchange to manage in the automation.

Step 1: Add the script to your sheet

1
Open your Google Sheet. Go to Extensions → Apps Script.
2
Delete any placeholder code and paste the script below.
3
Click Deploy → New deployment. Choose type Web app. Set "Execute as" to Me and "Who has access" to Anyone. Click Deploy and copy the Web app URL.
Apps Script — doPost handler (paste into Apps Script editor)
function doPost(e) {{
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var data  = JSON.parse(e.postData.contents);
  sheet.appendRow([
    new Date(),
    data.name,
    data.phone,
    data.email,
    data.message
  ]);
  return ContentService
    .createTextOutput(JSON.stringify({{ status: 'ok' }}))
    .setMimeType(ContentService.MimeType.JSON);
}}

// The first row of your sheet should have headers:
// Timestamp | Name | Phone | Email | Message
The first deploy asks for authorisation

When you deploy, Google asks you to authorise the script to edit your sheet. Approve it. You may see an 'unverified app' warning because it is your own private script: click Advanced, then 'Go to (project name)', then Allow. This is normal for personal Apps Script projects.

Step 2: Post to the webhook from WhatsApp

External API Request Step · WA.Expert
Select Method
POST
Request URL
https://script.google.com/macros/s/AKfy.../exec
Select Auth Type
No Auth (token in header if used)
Header Parameters
Content-Typeapplication/json
Select Body Type
JSON
Body
{{"name":"{{{{customer_name}}}}","phone":"{{{{customer_phone}}}}","email":"{{{{customer_email}}}}","message":"{{{{customer_message}}}}"}}
Choose Response Type
JSON
Webhook body and response
Body:
{{
  "name":    "{{customer_name}}",
  "phone":   "{{customer_phone}}",
  "email":   "{{customer_email}}",
  "message": "{{customer_message}}"
}}

Response: {{ "status": "ok" }}

A new row is appended to your sheet with a timestamp
and the four values. Done.
Why this is the easy path

The Apps Script runs as you, with your permissions, so it can write to the sheet without any API key or OAuth token in the WhatsApp automation. You only handle a plain webhook URL, exactly like any other webhook in WA.Expert.

Method 2: Direct Sheets API (advanced)

If you prefer not to add a script to your sheet, use Google's official Sheets API. This needs a service account and an OAuth access token, which is more setup.

Setup

1
In Google Cloud Console, create a project and enable the Google Sheets API.
2
Create a Service Account, generate a JSON key, and note the service account email (ends in iam.gserviceaccount.com).
3
Share your sheet with the service account email (Editor access). This is the step everyone forgets.
4
Exchange the service account key for an OAuth access token (a token endpoint call or a small helper). Use it as a Bearer token.
A plain API key will not work for writing

Google API keys only allow reading public sheets. Writing a row requires an OAuth 2.0 access token from a service account. This token exchange is the main reason Method 1 (Apps Script) is simpler for most WhatsApp automations.

The append request

External API Request Step · WA.Expert
Select Method
POST
Request URL
https://sheets.googleapis.com/v4/spreadsheets/{{{{SPREADSHEET_ID}}}}/values/Sheet1!A:E:append?valueInputOption=USER_ENTERED
Select Auth Type
No Auth (token in header if used)
Header Parameters
AuthorizationBearer YOUR_OAUTH_ACCESS_TOKEN
Content-Typeapplication/json
Select Body Type
JSON
Body
{{"values":[["{{{{timestamp}}}}","{{{{customer_name}}}}","{{{{customer_phone}}}}","{{{{customer_email}}}}","{{{{customer_message}}}}"]]}}
Choose Response Type
JSON
Sheets API append — body and response
URL (note the :append suffix and valueInputOption):
POST https://sheets.googleapis.com/v4/spreadsheets/SPREADSHEET_ID
     /values/Sheet1!A:E:append?valueInputOption=USER_ENTERED

Body:
{{
  "values": [
    ["2026-06-23", "Priya", "+919820000001",
     "priya@example.com", "Interested in pricing"]
  ]
}}

Response:
{{
  "updates": {{
    "updatedRange": "Sheet1!A5:E5",
    "updatedRows": 1,
    "updatedColumns": 5,
    "updatedCells": 5
  }}
}}

Map: updates.updatedRange, updates.updatedRows (1 = success)
PartValueNotes
spreadsheetIdFrom the sheet URLThe string between /d/ and /edit.
rangeSheet1!A:EA1 notation. The tab name plus the column range.
:appendURL suffixAppends after the last row of data in the range.
valueInputOptionUSER_ENTEREDInterprets dates and formulas. Use RAW for literal text.
values[[...]]An array of rows; each row is an array of cell values.

Worked example: log every new WhatsApp lead

Automation flow — log WhatsApp lead to Google Sheets (Method 1)
Trigger: A first-time contact sends a message, or a bot captures a lead.

Captured: {{customer_name}}    = Priya Sharma
          {{customer_phone}}   = +919820000001
          {{customer_email}}   = priya@example.com
          {{customer_message}} = Interested in pricing

External API Request step:
POST https://script.google.com/macros/s/AKfy.../exec
Content-Type: application/json
Body: {{name, phone, email, message}}

Response: {{status: 'ok'}}

Result: a new timestamped row in your 'WhatsApp Leads' sheet.
Your team can sort, filter, and follow up from the spreadsheet —
no manual copy-pasting from chats.

What teams log to Sheets

WhatsApp triggerRow logged to Sheets
New lead / first messageTimestamp, name, phone, source, first message
Order placed in commerce flowOrder ID, customer, items, total, address
Survey or feedback answerRating, comment, contact, date
Support requestIssue summary, priority, contact, timestamp
Appointment bookedName, phone, slot, service requested

Each is a WhatsApp automation that ends with an External API Request step posting a row to a Google Sheet. Sheets becomes your lightweight CRM or log.

Troubleshooting

SymptomLikely causeFix
Apps Script: nothing appendedWeb app deployed with wrong accessRedeploy with 'Who has access' set to Anyone and 'Execute as' set to Me. Use the /exec URL, not the /dev URL.
Apps Script: authorisation errorScript not authorisedRun the doPost function once manually in the editor, or redeploy and approve the authorisation prompt (Advanced → Go to project → Allow).
Sheets API: 403 permissionSheet not shared with service accountShare the sheet with the service account email (ends iam.gserviceaccount.com) as Editor. This is the most common Sheets API error.
Sheets API: 401Invalid or expired access tokenAccess tokens expire after about an hour. Refresh the token from the service account before each batch, or use Method 1 to avoid tokens entirely.
Wrong cell placementRange does not match the data tableThe :append endpoint finds the last row of the table in the given range. Use a range like Sheet1!A:E that covers your columns.
Dates stored as textvalueInputOption set to RAWUse valueInputOption=USER_ENTERED so Google interprets dates and numbers.

Common questions

What is the simplest way to log to Sheets?
+
The Apps Script webhook (Method 1). Paste a doPost script, deploy as a web app, post JSON to the URL. No OAuth, no API key, no service account.
Can I use a Google API key to write a row?
+
No. API keys only read public sheets. Writing needs an OAuth token or service account. Method 1 sidesteps this by running the script as you.
Why the 403 caller does not have permission?
+
With the Sheets API, the sheet is not shared with the service account email. Share it (Editor) with the address ending iam.gserviceaccount.com.
Where is the spreadsheet ID?
+
In the sheet URL between /d/ and /edit. Needed for Method 2; not needed for Method 1.
What is the append endpoint?
+
POST /v4/spreadsheets/{id}/values/{range}:append?valueInputOption=USER_ENTERED with a Bearer token. Body: {values: [[...]]}.
Does this incur extra WA.Expert charges?
+
One automation action per External API Request call. Included on the Complete plan. Starter: from Rs. 49 per 1,000 actions. Google's APIs are free within quota.

Connect Google Forms to WhatsApp

Trigger WhatsApp messages when a Google Form is submitted.

Read guide →

Connect Airtable to WhatsApp

Log and look up WhatsApp data in an Airtable base.

Read guide →

External API Request Step

Master every field in WA.Expert's HTTP action step.

Read foundation guide →

Connect Google Sheets to WhatsApp today

Free trial, no credit card. If you get stuck, we answer live on WhatsApp.

Start Free Trial → Book a Demo
1