Plenty of businesses still want a spreadsheet. The owner checks it on a phone, the accountant sorts it, the marketing contractor builds a chart from it. Copying leads in by hand is exactly the kind of job GoHighLevel should do for you.
This guide shows how to send GoHighLevel to Google Sheets without a paid connector: a Custom Webhook action in a workflow posts each lead to a small Google Apps Script, which adds a row. It takes about fifteen minutes, costs nothing beyond your normal workflow usage, and includes a simple secret check so random requests cannot write to your sheet.
What you will build
- A Google Sheet with a header row.
- An Apps Script web app that accepts a POST request and appends a row.
- A GoHighLevel workflow step that sends the lead’s details to that web app.
Step 1: prepare the sheet
Create a new Google Sheet and name the first tab Leads. Add these headers in row 1:
Received at | First name | Last name | Email | Phone | Source | Tags | Contact IDStep 2: add the Apps Script
In the sheet, open Extensions → Apps Script, delete the sample code and paste the script below. Replace the secret with a long random string of your own.
// Shared secret: the same value goes in the GoHighLevel webhook body.
const SECRET = 'replace-with-a-long-random-string';
const SHEET_NAME = 'Leads';
function doPost(e) {
let data;
try {
data = JSON.parse(e.postData.contents);
} catch (err) {
return reply({ ok: false, error: 'Invalid JSON' });
}
if (data.secret !== SECRET) {
return reply({ ok: false, error: 'Unauthorised' });
}
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(SHEET_NAME);
const lock = LockService.getScriptLock();
lock.waitLock(10000); // stop two leads writing to the same row at once
try {
sheet.appendRow([
new Date(),
data.first_name || '',
data.last_name || '',
data.email || '',
data.phone ? "'" + data.phone : '', // keep the leading + on phone numbers
data.source || '',
data.tags || '',
data.contact_id || '',
]);
} finally {
lock.releaseLock();
}
return reply({ ok: true });
}
function reply(obj) {
return ContentService.createTextOutput(JSON.stringify(obj))
.setMimeType(ContentService.MimeType.JSON);
}Two small details make this reliable. The lock stops two leads arriving at the same moment from overwriting each other, and the apostrophe before the phone number stops Sheets from treating +44… as a formula or dropping the leading plus.
Step 3: deploy the script as a web app
- Click Deploy → New deployment and choose the type Web app.
- Set Execute as to Me and Who has access to Anyone. The secret check is what protects the sheet.
- Authorise the script when Google asks, then copy the Web app URL ending in
/exec.
Step 4: add the webhook to a GoHighLevel workflow
- Open the workflow that handles new leads — for example one triggered by a form submission.
- Add the Custom Webhook action and choose the custom mode so you can send a JSON body.
- Set the method to POST, paste the web app URL, and set the content type to
application/json. - Build the body with contact merge fields from the field picker, plus your secret:
{
"secret": "replace-with-a-long-random-string",
"first_name": "{{contact.first_name}}",
"last_name": "{{contact.last_name}}",
"email": "{{contact.email}}",
"phone": "{{contact.phone}}",
"source": "{{contact.source}}",
"tags": "{{contact.tags}}",
"contact_id": "{{contact.id}}"
}Insert the merge fields with GoHighLevel’s own picker rather than typing them, so they exactly match what your account offers. If a field is not available, leave it out of the body and remove the matching column from the script.
Step 5: test it
- Use the workflow’s test option, or submit the form yourself.
- Check that a new row appears in the sheet within a few seconds.
- If nothing arrives, open the workflow’s execution log; it shows the response from the web app.
- Send one request with a wrong secret to confirm the script rejects it.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| Response is “Unauthorised” | The secret in the body does not match the script | Copy the same value into both places |
| Response is an HTML page | The deployment is not shared with “Anyone” | Edit the deployment’s access setting |
| Rows appear but some cells are empty | Key names differ between the body and the script | Match first_name, email and so on exactly |
| Script changes have no effect | The deployment still serves the old version | Publish a new version of the existing deployment |
| Phone numbers lose the + sign | Sheets treats them as numbers | Keep the apostrophe prefix shown in the script |
Ideas for extending it
- One tab per source. Pass a
tabvalue in the body and use it instead of the fixed sheet name. - Update instead of append. Search the Contact ID column and update the existing row when a lead changes stage.
- Pipeline log. Trigger the webhook from opportunity stage changes to build a simple sales history.
- Client reporting. Feed the sheet into a chart or dashboard — see our client reporting guide.
Privacy
A spreadsheet is easy to share by accident. Keep the sheet’s sharing settings tight, send only the fields you need, and do not use this pattern for sensitive data such as health or financial details. If the secret is ever exposed, change it in both the script and the workflow.
For two-way syncing or larger volumes, call the API instead — see our GoHighLevel API guide. For no-code connectors, our Zapier and Make guide compares the options.
Frequently asked questions
Does this cost anything?
Google Apps Script is free within Google’s usage quotas. In GoHighLevel, the Custom Webhook action may count as a premium workflow action depending on your plan.
Is “Anyone” access safe?
The URL is long and unguessable, and the script ignores any request without the correct secret. That is adequate for lead logging; it is not designed for sensitive data.
Can I send older contacts too?
Yes. Add the contacts to the workflow in bulk, or export them once as a CSV and paste them into the sheet.
What happens if the tab is renamed?
The script looks for the tab by name, so update SHEET_NAME if you rename it.
This guide is part of our GoHighLevel Setup Guides series — setup guides covering the whole topic.



