/**
* ADVENTURE CREW APPLICATIONS — Google Sheets webhook
*
* SETUP
* 1. Make a NEW Google Sheet called "Adventure Crew Applications".
* 2. Extensions → Apps Script. Delete anything there, paste this in, save.
* 3. Deploy → New deployment → type "Web app".
* Execute as: Me. Who has access: Anyone.
* 4. Copy the web app URL and paste it into SHEET_WEBHOOK_URL in the form.
* 5. Submit a test application and check the row lands correctly.
*
* Note: the first deployment asks you to authorize the script. That's
* normal — it's your own script writing to your own sheet.
*/
var HEADERS = [
"Timestamp","Name","Email","What they do","Industry","LinkedIn",
"Season","What they want to build","What's stopped them","The idea",
"Five sessions","Ready to invest","Time zone","Preferred time",
"What might get in the way","Nominated","Found via","Anything else"
];
function doPost(e) {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];
if (sheet.getLastRow() === 0) {
sheet.appendRow(HEADERS);
sheet.getRange(1, 1, 1, HEADERS.length).setFontWeight("bold");
sheet.setFrozenRows(1);
}
var d = JSON.parse(e.postData.contents);
sheet.appendRow([
new Date(d.timestamp || new Date()),
d.name || "", d.email || "", d.work || "", d.industry || "", d.linkedin || "",
d.season || "", d.next || "", d.stuck || "", d.idea || "",
d.commitment || "", d.investment || "", d.timezone || "", d.timeslot || "",
d.obstacle || "", d.nominate || "", d.referral || "", d.anything || ""
]);
// Email yourself so you don't have to watch the sheet.
try {
MailApp.sendEmail({
to: Session.getEffectiveUser().getEmail(),
subject: "Adventure Crew application — " + (d.name || "someone"),
body: [
d.name + " <" + d.email + ">",
d.work + " · " + d.industry,
"",
"SEASON: " + d.season,
"",
"WANTS TO BUILD: " + d.next,
"",
"STOPPED BY: " + d.stuck,
"",
"THE IDEA: " + (d.idea || "—"),
"",
"Five sessions: " + d.commitment,
"Investment: " + d.investment,
"Time: " + d.timeslot + " (" + d.timezone + ")",
"Might get in the way: " + (d.obstacle || "—"),
"Nominated: " + (d.nominate || "—"),
"Found via: " + (d.referral || "—"),
"Anything else: " + (d.anything || "—")
].join("\n")
});
} catch (err) {}
return ContentService.createTextOutput("ok");
}

