Documentation & Setup Guides
Step-by-step tutorials for Google Sheets integration and troubleshooting.
Guide Sections
Google Sheets Webhook Integration
Official Google Integration Video Guide
Official TutorialStep-by-Step Text Guide
1
Create a New Google Spreadsheet
Go to sheets.google.com and create a blank spreadsheet. Name it "GeoExtract Leads" or any name you prefer.
2
Open Apps Script Editor
In your spreadsheet, click Extensions → Apps Script. This opens the script editor.
3
Paste the Webhook Code
Delete any existing code in the editor and paste the Apps Script code shown below.
4
Deploy as Web App
Click Deploy → New Deployment → Select "Web app" → Set "Who has access" to "Anyone" → Click Deploy.
5
Authorize & Copy URL
Click "Authorize access" and complete the Google authorization flow. Copy the Web App URL that appears after deployment.
6
Paste Webhook URL in GeoExtract
Go to GeoExtract Dashboard → Settings → Google Sheets tab → Paste the webhook URL → Click Save & Test.
Google Apps Script Code
function doPost(e) {
try {
var data = JSON.parse(e.postData.contents);
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var statusOptions = ["New", "Contacted", "In Progress", "Qualified", "Not Interested", "Converted"];
var statusRule = SpreadsheetApp.newDataValidation()
.requireValueInList(statusOptions, true)
.setAllowInvalid(true)
.build();
// Add headers if sheet is empty
if (sheet.getLastRow() === 0) {
sheet.appendRow(["Business Name", "Phone", "Website", "Rating", "Reviews", "Address", "City", "State", "Status", "Extracted At"]);
sheet.getRange(1, 1, 1, 10).setFontWeight("bold").setBackground("#4F46E5").setFontColor("#FFFFFF");
}
var leads = Array.isArray(data) ? data : [data];
leads.forEach(function(lead) {
var rawPhone = lead.phone || lead.mobileNumber || "";
var phoneValue = (rawPhone && rawPhone !== "N/A" && typeof rawPhone === "string" && rawPhone.startsWith("+"))
? ("'" + rawPhone)
: (rawPhone || "N/A");
var leadStatus = lead.status || "New";
sheet.appendRow([
lead.name || "",
phoneValue,
lead.website || "",
lead.rating || 0,
lead.reviewCount || 0,
lead.address || "",
lead.city || "",
lead.state || "",
leadStatus,
lead.extractedAt || new Date().toISOString()
]);
var lastRow = sheet.getLastRow();
sheet.getRange(lastRow, 2).setNumberFormat("@");
sheet.getRange(lastRow, 9).setDataValidation(statusRule);
});
return ContentService.createTextOutput(JSON.stringify({ result: "success", count: leads.length }))
.setMimeType(ContentService.MimeType.JSON);
} catch (err) {
return ContentService.createTextOutput(JSON.stringify({ result: "error", error: err.toString() }))
.setMimeType(ContentService.MimeType.JSON);
}
}