← Setup guides

How to send your chatbot's leads to Google Sheets with a webhook

Every lead your assistant captures can land as a new row in a Google Sheet you own, seconds after it's caught. The lead webhook posts to a short script inside the sheet, so there's no Zapier or Make account in between and nothing for Google to review.

Before you start

Steps

  1. Create a new Google Sheet and give it a name, such as "Website leads". Leave it empty: the script writes the header row itself.
  2. In the sheet, open Extensions, then Apps Script. A code editor opens in a new tab.
  3. Delete what's in the editor and paste the script shown under these steps. Replace paste-a-long-random-string-here with a long random string of your own, 30 characters or more, and save.
  4. Click Deploy, then New deployment. Next to "Select type", click the gear and choose Web app. Set it to execute as you ("Me"), set who has access to "Anyone", and click Deploy.
  5. Google asks you to authorize the script, and may first warn that it hasn't verified the app. That's because the script is your own and unpublished: it asks to edit this one spreadsheet and runs under your Google account. We never see that account.
  6. Copy the web app URL, which ends in /exec. Add ?key= and your random string to the end of it, with no spaces.
  7. In your dashboard, open Integrations, find "Zapier, Make and CRMs" and paste the address in. Save it, then press "Send a test lead".
  8. Look at your sheet. It should now have a header row and a row for "Test lead" on +44 7700 900000. Delete that row, then leave a real inquiry on your own website and watch it arrive too.

The script to paste in step 3

It reads the lead we send, checks the key in the address, skips a lead id it already has, and adds one row. The apostrophe it puts in front of text makes Google Sheets store what a visitor typed as plain text, never as a formula.

/** @OnlyCurrentDoc */
const KEY = "paste-a-long-random-string-here";

function doPost(e) {
  if (e.parameter.key !== KEY) return HtmlService.createHtmlOutput("ignored");
  const data = JSON.parse(e.postData.contents);
  const lead = data.lead || {};
  const text = (value) => (value ? "'" + value : "");
  const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];
  if (sheet.getLastRow() === 0) {
    sheet.appendRow(["Lead id", "Received", "Type", "Name", "Phone", "Email",
      "Service", "Area", "Preferred time", "Urgent", "Other details", "Leads screen"]);
  }
  const seen = sheet.getRange("A:A").createTextFinder(data.id).matchEntireCell(true).findNext();
  if (!seen) {
    sheet.appendRow([text(data.id), new Date(data.createdAt), data.type,
      text(lead.name), text(lead.phone), text(lead.email), text(lead.serviceType),
      text(lead.addressOrArea), text(lead.preferredTime), lead.urgent ? "yes" : "",
      text(JSON.stringify(lead.details || {})), data.dashboardUrl]);
  }
  return HtmlService.createHtmlOutput("ok");
}

Platform steps checked on October 7, 2026 against Google for Developers: Apps Script web apps

Good to know

Can't edit your website?

Every assistant has its own chat page. Link to it from your website's menu, your Google Business Profile, social media or email signature. Or use "Email this to my web person" on your Widget page to send the code to whoever runs your site.

Questions

Do I need Zapier or Make to send chatbot leads to Google Sheets?

No. The lead webhook posts straight to a script that lives in your own sheet, so there's no automation account and no monthly task limit in between. If you'd rather not paste a script, Make's free plan does the same job; the steps are in our CRM guides.

Is it safe to set access to "Anyone"?

It means anyone who has the full address can run the script, which is why the address carries a long random key and the script ignores a request without it. The script can only add rows to this one sheet: it can't read the sheet back to a caller or touch your other files. Google doesn't show request headers to the script, so it can't check our signature; keep the address private. How we sign and send leads is on our security page.

Can I add, remove or reorder the columns?

Yes. Change the header list and the row list in the script in the same way, keep the lead id in column A (the script uses it to spot a repeat), and deploy a new version. Clear the old header row first if you've changed it.

Can leads go to a sheet and a CRM at the same time?

Not from us directly: an assistant has one webhook address. Point it at Make and let one scenario write to both your sheet and your CRM, as in the HubSpot guide. Every lead still reaches you by email alert either way.

Try it on your own website

Your customers are asking right now

Paste your website and see your assistant answer as your business. It takes about a minute.

  • No account needed
  • No card
  • Free plan forever

Want the details first? See pricing