GOOGLE SHEETS SETUP
Follow these steps to connect your forms to Google Sheets — so every submission is saved automatically.
Open Google Apps Script
Go to script.google.com and create a new project.
Create a Google Sheet
Open a new Google Sheet (sheets.google.com). It will be linked automatically.
Paste the script
Delete all default code in the editor and paste the script below.
Open the script from the Sheet
In your Google Sheet go to Extensions → Apps Script. This links the script to your sheet.
Deploy as Web App
Click Deploy → New Deployment → Web App. Set 'Who has access' to 'Anyone'. Copy the URL.
Paste the URL in your app
Open lib/submissions.js and replace YOUR_GOOGLE_APPS_SCRIPT_URL_HERE with your deployment URL.
// ──────────────────────────────────────────────────────
// JACKED VENDING — Google Apps Script Backend
// Paste this into: script.google.com → New Project
// Then: Deploy → New Deployment → Web App → Anyone
// ──────────────────────────────────────────────────────
const SHEET_NAME = "Submissions";
const NOTIFY_EMAIL = "Jackedvending@gmail.com";
function doPost(e) {
try {
const data = JSON.parse(e.postData.contents);
saveToSheet(data);
sendNotificationEmail(data);
if (data.email) sendAutoReply(data);
return ContentService.createTextOutput(JSON.stringify({ success: true }))
.setMimeType(ContentService.MimeType.JSON);
} catch (err) {
return ContentService.createTextOutput(JSON.stringify({ success: false, error: err.message }))
.setMimeType(ContentService.MimeType.JSON);
}
}
function saveToSheet(data) {
const ss = SpreadsheetApp.getActiveSpreadsheet();
let sheet = ss.getSheetByName(SHEET_NAME);
if (!sheet) {
sheet = ss.insertSheet(SHEET_NAME);
sheet.appendRow([
"Timestamp","Type","Name","Email","Phone","Business",
"Address","Location Type","Traffic","Product","Message","Score"
]);
sheet.getRange(1,1,1,12).setFontWeight("bold").setBackground("#f3f3f3");
}
const score = calcScore(data);
sheet.appendRow([
new Date().toLocaleString(),
data.type || "",
data.name || data.full_name || "",
data.email || "",
data.phone || "",
data.business_name || "",
data.address || "",
data.location_type || "",
data.daily_traffic || "",
data.product || data.product_requested || "",
data.message || "",
score,
]);
}
function calcScore(data) {
let score = 0;
if (data.type !== "machine_request") return "";
const lt = (data.location_type || "").toLowerCase();
if (lt.includes("gym")) score += 3;
if (lt.includes("school") || lt.includes("university")) score += 3;
const traffic = parseInt(data.daily_traffic) || 0;
if (traffic > 100) score += 2;
return score;
}
function sendNotificationEmail(data) {
const isMachine = data.type === "machine_request";
const subject = isMachine
? `🏢 New Machine Request — ${data.name || data.full_name} · ${data.location_type}`
: `🛒 New Product Request — ${data.product || data.product_requested} (${data.name || data.full_name})`;
const body = isMachine ? `
NEW VENDING MACHINE REQUEST
──────────────────────────
Name: ${data.name || ""}
Email: ${data.email || "N/A"}
Phone: ${data.phone || "N/A"}
Business: ${data.business_name || "N/A"}
Address: ${data.address || ""}
Location Type: ${data.location_type || ""}
Daily Traffic: ${data.daily_traffic || "N/A"}
Lead Score: ${calcScore(data)} pts
Message:
${data.message || "None"}
` : `
NEW PRODUCT REQUEST
──────────────────
Name: ${data.name || data.full_name || ""}
Email: ${data.email || "N/A"}
Phone: ${data.phone || "N/A"}
Location: ${data.location || "N/A"}
Product: ${data.product || data.product_requested || ""}
Category: ${data.product_type || "N/A"}
Message:
${data.message || "None"}
`;
GmailApp.sendEmail(NOTIFY_EMAIL, subject, body.trim());
}
function sendAutoReply(data) {
const name = data.name || data.full_name || "there";
const isMachine = data.type === "machine_request";
const subject = "We got your request! — Jacked Vending";
const body = isMachine
? `Hi ${name},\n\nThanks for requesting a vending machine! We've received your submission and will reach out within 24–48 hours.\n\nLocation: ${data.address}\nType: ${data.location_type}\n\n— Jackson Hjorth\nCEO, Jacked Vending\nJackedvending@gmail.com`
: `Hi ${name},\n\nThanks for your product request! We received it and will do our best to stock "${data.product || data.product_requested}" in our machines.\n\n— Jackson Hjorth\nCEO, Jacked Vending\nJackedvending@gmail.com`;
GmailApp.sendEmail(data.email, subject, body);
}After deploying, update your URL
Open lib/submissions.js and replace YOUR_GOOGLE_APPS_SCRIPT_URL_HERE with your deployment URL. Forms will then automatically save to Google Sheets.