PLEASE NOTE: This is a fairly technical task and involves a little bit of coding, our support in this area goes as far as this document, but if you require further assistance we can be commissioned to do this whole work for you!!
Google Sheets has a rich scripting language that allows you to do all sorts of automation for your spreadsheets, and not many people know about it!
It can even receive POST requests without needing a custom piece of infrastructure using webhooks which means we can integrate with it with Databowl and send live leads to it with only a little bit of code added to the sheet.
Set up your Google Sheet
1. First, you'll need to be the owner of the Google Sheet for this to work properly.
In the past we've had issues with shared sheets when users don't own them, so it might be best to start with a fresh sheet.
Once you have this set, from your Google Sheet you need to get to the script editor.
Go to Extensions
and then Apps Scripts
2. Paste this script into the script code editor, replace any code that was there and hit Save.
function doGet(e) {
return ContentService
.createTextOutput(JSON.stringify({ status: "ok", message: "GET not supported, use POST" }))
.setMimeType(ContentService.MimeType.JSON);
}
function doPost(e) {
try {
const myData = JSON.parse(e.postData.contents);
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Leads"); // replace with your actual tab name
if (!sheet) throw new Error("Sheet not found");
const lastRow = sheet.getLastRow() + 1;
sheet.getRange(lastRow, 1).setValue(myData.leadid || "");
sheet.getRange(lastRow, 2).setValue(myData.firstname || "");
sheet.getRange(lastRow, 3).setValue(myData.lastname || "");
sheet.getRange(lastRow, 4).setValue(myData.email || "");
sheet.getRange(lastRow, 5).setValue(myData.phone || "");
SpreadsheetApp.flush();
return ContentService
.createTextOutput(JSON.stringify({ status: "success", message: "Lead stored" }))
.setMimeType(ContentService.MimeType.JSON);
} catch (err) {
return ContentService
.createTextOutput(JSON.stringify({ status: "error", message: err.message }))
.setMimeType(ContentService.MimeType.JSON);
}
}
Map Your Fields
In this example you can see the following mapped fields are being used:
sheet.getRange(lastRow, 1).setValue(myData.leadid);
sheet.getRange(lastRow, 2).setValue(myData.firstname);
sheet.getRange(lastRow, 3).setValue(myData.lastname);
sheet.getRange(lastRow, 4).setValue(myData.email);
sheet.getRange(lastRow, 5).setValue(myData.phone);
These are leadid, firstname, lastname, email, phone
These field names must match exactly what you're using in your Databowl forwarder field mapping.
Field Naming Tips
For best results:
Avoid spaces in field names
Stick to characters: A–Z, 0–9,
_
(underscore), or-
(hyphen)
Instead of:
First Name
Use something like:
firstname / first_name / FirstName / firstName
The naming convention is totally up to you — just make sure your script and forwarder use the same names.
Adding New Fields
If you're adding additional fields, you'll need to do two things:
Update your forwarder in Databowl with the new field name
Add a new line in the Apps Script to write that value to the next column in the sheet
Example:
sheet.getRange(lastRow, 6).setValue(myData.newfield);
In this case:
6
means the 6th column (Column F)newfield
is the exact name of the field being sent in the request
⚠️ Important:
Always increase the column number when adding new fields — otherwise, you'll overwrite existing data.
Adding Data to a Specific Sheet or Tab
By default, the script uses the active sheet/tab — that’s controlled by this line:
var sheet = SpreadsheetApp.getActiveSheet();
This works fine if your spreadsheet only has one tab, or if you never change tabs manually.
Targeting a Specific Sheet by Name
To ensure your data always goes to a specific tab (e.g. "Leads"
), replace that line with:
var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheetByName("Leads"); // Replace "Leads" with your tab name
This makes your script more reliable — even if someone clicks onto another tab in the spreadsheet.
Publishing Your Code as a Web App
To make your Google Apps Script available for Databowl (or any other system) to send data to, you'll need to deploy it as a web app.
Follow these steps:
In the Apps Script editor, click the Deploy button in the top right
Choose "Web App" as the deployment type
Fill in the fields:
Description: Add a name you’ll recognise (e.g. “Databowl Sheet Webhook”)
Execute as: Select "Me"
Who has access: Select "Anyone"
This is required so external systems like Databowl can post data to it
Click Deploy
Copy the web app URL provided — you’ll use this as your endpoint in Databowl
P
Authorise the app if requested
Copy the web app url as shown below
Set up your forwarder
Get Your URL for testing
The URL that you got in the previous step will be the webhook that you can use in your forwarder.
This should look like this:
https://script.google.com/macros/s/UNIQUE_KEY_HERE/exec
Ensure its a JSON as content type.
If your's looks a little different, see the troubleshooting steps below.
You can test this webhook in your browser first by pasting it. It will say “request received” if you have things set up correctly. You should also see a cell in your spreadsheet populate.
Map Your Responses
Your new Google Apps Script now returns a clean JSON response like this:
{ "status": "success", "message": "Lead stored" }
Troubleshooting
Your URL is not working
Depending on your Google Apps instance, you may need to adjust the URL to make it work.
If your URL is not:
Or:
Take the unique key from the URL you have and use it in the first format above.
Adding new fields or changing your setup
If you need to add more fields or change things, that's fine, just go back through the steps.
Remember that if you have email in column 1, and then you change it to column 2 in the code, you may want to first move your existing data around in the sheet, otherwise you'll end up with emails all over the place.
Data validation on the sheet
If you're supplying data to a sheet that uses dropdowns or other validation, make sure that the data from Databowl is formatted correctly.
Enjoy.
Now you can sit back and chill out whilst we deliver leads to Google Sheets for you.
🚀 Need More assistance?
If you're stuck or if this isn't something you or your team is comfortable with, then please open a new chat/ticket (chat icon in the bottom right of the screen) or email support@databowl.com.
We're here to assist with any questions you have, and if required we can quote on actioning work like this for as part of our Marketing Services.