Connect Google Sheets With Bricks Forge Pro Form Webhook
HTML-код
- Опубликовано: 2 июн 2024
- In this video, you will learn how to connect Google Sheets with your Bricks Builder Forms. We user Bricks Forge Pro Forms and webhooks to send the form data to Google sheets using a Google Apps script.
The JavaScript for simple forms like the one shown in the video (JS for advanced forms is at the bottom):
function doPost(e) {
//get the active spreadsheet that this app script is attached to.
var sheet = SpreadsheetApp.getActiveSheet();
// Parsing the data received from the webhook
var data = JSON.parse(e.postData.contents);
//create an array of data parsed from the JSON
var row = [data.name, data.email, data.phone, data.message,data.response];
//append the array of JSON data to the spreadsheet
sheet.appendRow(row);
return ContentService.createTextOutput(JSON.stringify({result: "success"}))
.setMimeType(ContentService.MimeType.JSON);
}
Wondering what tools I use at my agency? check them out below!
Bricks Forge: bricksforge.io/?aff=c5a44148
Meta Box: metabox.sjv.io/qn39VL
Automatic CSS: automaticcss.com/ref/41/
Fathom GDPR Analytics: usefathom.com/ref/QPRTID
Vultr Servers: www.vultr.com/?ref=9088377
Fluent Forms: fluentforms.com/?ref=1552
Slim SEO: slim-seo.sjv.io/QOaOqa
Rank Math: rankmath.com/?ref=john-2176
WP Code Box: wpcodebox.com/?ref=190
GridPane Hosting: gridpane.com/?via=john70
Chapters
0:00 Intro
1:55 Google Apps Script Setup
9:34 Bricks Forge Pro Form Setup
19:00 Experiments!
Java Script for advanced forms that have check box, radio, and select fields:
function doPost(e) {
// Get the active spreadsheet that this app script is attached to.
var sheet = SpreadsheetApp.getActiveSheet();
// Parsing the data received from the webhook
var data = JSON.parse(e.postData.contents);
// Function to handle array inputs (e.g., from multi-select lists)
function processArray(value) {
if (Array.isArray(value)) {
return value.join(', '); // Joining the array elements with a comma and space
}
return value;
}
// Create an array of data parsed from the JSON, processing array inputs
var row = [
processArray(data.name),
processArray(data.email),
processArray(data.phone),
processArray(data.message)
];
// Append the array of JSON data to the spreadsheet
sheet.appendRow(row);
return ContentService.createTextOutput(JSON.stringify({result: "success"}))
.setMimeType(ContentService.MimeType.JSON);
}
This really helped with my sister-in-law's wedding RSVP form. Great tutorial! Thank you so much.
Awesome! Glad to hear it. Webhooks are addicting and a lot of fun!
👏👌
Thanks
Great tutorial and easy to understand. Does this also work with Docs? How do I change the JavaScript code for this?
It can be modified I bet, but I personally have never written data to a google doc. I imagine there's code for that. You would have to do a little research on it. If you need some custom work done, I'm available to do that type of work.
Is it also possible to develop something like calendly ?
I suppose you could add automations to make it like Calendly. The tricky party is syncing with a calendar to check availability. That's where Calendly shines.
exactly@@aperturedigitalmarketing