Members-only tutorial
Watch the video and get the practice sheet with membership.
About this Tutorial
Sheet Resources
Video Transcript
<div>00:00 So in this video, we will create an embedded email form and name form into a website. Uh, we'll use Google Sites, uh, from Google Sites into a Google Sheet.<br>00:11 Now, what this does is it builds on email-to-sheets. This is a previous video where Learn how to filter data using the query where clause in Google Sheets. Opens in new tab I showed you how to capture an email, uh, from your Google Site or website, it's an embedded HTML form, directly into Google Sheets.<br>00:26 You don't need to use Zapier Discover how Zapier can automate tasks between your apps and Google Sheets. Opens in new tab , you don't need to use anything. I want to just prepare you for a little bit of, uh, information here.<br>00:37 This is super unsophisticated and unsecure.
I just want to make sure that you understand that.
Um, we're using Google Servers, uh, in a Google Sheet, so if you're, if you haven't watched the other video, it's okay, I'm going to try to go over that very quickly here.<br>00:56 Basically, we have this, this HTML that we embed onto the site, and we're going to create a web app deployment URL from Apps Script Explore Google Apps Script to enhance your Google Sheets functionality. Opens in new tab that's essentially going to do this doPost Understand the doPost function for handling HTTP POST requests in Apps Script. Opens in new tab .<br>01:10 It's going to take in a URL that it gets sent, and it's going to parse it for the parameters Get to know parameters and how they work in Google Apps Script. Opens in new tab of email.<br>01:17 Now, someone has asked, a member has asked, hey, how do you add more parameters Get to know parameters and how they work in Google Apps Script. Opens in new tab ?
How do you add a name here?<br>01:25 And so that's what we're going to do in this video. There's a lot of moving parts to this, so I'm going to try it.<br>01:30 I'm try to explain it in a drawing Learn about drawing tools in Google Sheets for better data visualization. Opens in new tab very quickly. So, we have a website. We have a website and a Google Sheet.<br>01:42 Let's make the Google Sheet green and the website blue. Alright. And we want the, uh, a form here. Let's make this white.<br>01:56 A form here to enter your email.
And what it's doing does is, in this form, it's a JavaScript and it, when you hit submit, it sends to a URL.<br>02:08 Well, where Learn how to filter data using the query where clause in Google Sheets. Opens in new tab that URL is, is not actually going to be on the Sheet. Actually, it is on the Sheet. But, it's on a little part of the Sheet called Apps Script Explore Google Apps Script to enhance your Google Sheets functionality. Opens in new tab .<br>02:18 So, we're going to create Apps Script Explore Google Apps Script to enhance your Google Sheets functionality. Opens in new tab here. We'll make that grey, let's say.
And here in Apps Script Explore Google Apps Script to enhance your Google Sheets functionality. Opens in new tab , we're going to what's called a due post, and we're going to, will deploy this, and this is going to be deployed to web, as a web app.<br>02:37 And what this deployed to web app, Apps Script Explore Google Apps Script to enhance your Google Sheets functionality. Opens in new tab does, is it creates on Google servers a URL that you can send data Understand data types and structures in Google Sheets. Opens in new tab to.<br>02:45 So, now, this Apps Script Explore Google Apps Script to enhance your Google Sheets functionality. Opens in new tab and this form will have a connection.
Basically, extremely insecure connection, sorry to keep saying that, I just want to harp on that, just to make sure you know what, uh, you're dealing with here.<br>02:58 But, essentially, So it's just a URL that you send a link to a text parameter Dive into the concept of parameters in programming and scripting. Opens in new tab that says this, the email is equal to whatever the text is in this box.<br>03:05 And then it's going to send it to this Apps Script Explore Google Apps Script to enhance your Google Sheets functionality. Opens in new tab , the Apps Script Explore Google Apps Script to enhance your Google Sheets functionality. Opens in new tab is going to take it, and parse that for the parameter Dive into the concept of parameters in programming and scripting. Opens in new tab that it's, the text that says the email, and then it's going to enter it into a sheet.<br>03:15 And so we have, uh, the sheet here, which I'll show you here, emails, and it's just going to go, add the email here, and we're going to also add a date.<br>03:23 So, the Apps Script Explore Google Apps Script to enhance your Google Sheets functionality. Opens in new tab looks like this, it's just a do post, this is a built-in function Learn about functions and how to use them in Google Sheets. Opens in new tab that we can deploy as Find out how to deploy your Apps Script as a web app. Opens in new tab a web app, and it just takes a second what we're going to call a URL, that's just the text we use, the variable.<br>03:35 And now this all works, let's, let's actually make sure it works.
I created the code here, uhm, for you to enter the web app deployment URL, let's get that, let's do that first, let's get the URL.<br>03:48 So, I want to deploy new deployment, and this is just deploying the entire Apps Script Explore Google Apps Script to enhance your Google Sheets functionality. Opens in new tab . We're going to execute as Understand the execute as feature in Google Apps Script. Opens in new tab me, but anyone has access.<br>03:59 We're going to hit deploy, and it's going And we're us a URL. This URL, this is what we want to enter into the, uh, form.<br>04:08 So, it's going to take a little bit of time. We do have to authorize it. Okay.
Again, this takes a bit of time, like moments, not hours, obviously.<br>04:21 I haven't paused the video yet. All right. Here's our web app URL Learn how to create and use a web app URL in Google Apps Script. Opens in new tab . So in our- our form HTML, we're going to put in, uh, actually I made it really easy.<br>04:39 You just copy it into this C2 and then it's going to substitute it. So now we have this text here with the URL.<br>04:46 So let's go and embed that into our sheet. We're going to embed the code. Paste. Next. That is what it looks like.<br>04:57 Insert it. And let's publish Discover how to publish your Google Sheets and Apps Script projects. Opens in new tab it. Publish Discover how to publish your Google Sheets and Apps Script projects. Opens in new tab this at, uhm, email and name to sheets. Publish Discover how to publish your Google Sheets and Apps Script projects. Opens in new tab .
So now we have a Google site.<br>05:16 Let's go view that. Uh, it's going to be at, I don't know if you can see this URL up here, but it's sites.google.com slash bettersheets.co slash email and name to sheets.<br>05:27 Let's enter or a email address. Andy at gmail.com. Hit submit. You've successfully registered. We added that, uh, text actually right here.<br>05:45 You've successfully registered your email. And if we go back to our emails, we can see Andy at gmail.com and we have a timestamp Understand how to work with timestamps in Google Sheets. Opens in new tab , timestamp Understand how to work with timestamps in Google Sheets. Opens in new tab and a date here.<br>05:53 Great. So now let's add name.
So on our, let's do this here for you. So we want to capture the name first.<br>06:03 So we have this variable email. It's just params.email. So we can do vari, uh, variable names equals params.names. Uhm, and then we need to set the value, so we're going to put the value in, let's put it in three, column three.<br>06:31 Names. I'm saying names here because I, there might be a saved parameter Dive into the concept of parameters in programming and scripting. Opens in new tab called name. We can, let's, let's just try name.<br>06:42 If it doesn't work, we're going to rename this names, but let's just try name or, um, yeah, that's it.
That's all name.<br>06:51 We can also do this like first name, first name. That might be a better first name. We'll do all lowercase here.<br>07:01 But I have this uppercase N here. Let's do that just to make sure it works. On our code, we need to create another input.<br>07:14 So we see this input name equals email. See, and that's also why I wanted to, uh, put first name. So input name equals first name.<br>07:30 and we're putting it in the oven. An input, uhm, tag here.
The other thing we need to do is in this form action, I don't know if you can see this, we have, this con, we've concatenated this URL, question mark email equals, and then we put in the form dot email dot value.<br>07:53 So we're going to add to that. We're going to do another plus, and then a single quote.
And do first name equals, do a single quote, a plus, now form dot first name, with a capital N, first name dot value.<br>08:15 So now we should be adding this first name in text equals Learn about text comparison and equality in Google Sheets. Opens in new tab , and then with this form dot first name dot value, we're going to add that name.<br>08:24 so let's hit that and let's update our we've updated our script Let's deploy again so we can manage deployments. We don't have to redo Find out how to redo actions in Google Sheets. Opens in new tab the URL.<br>08:37 We just have to update the configuration.
I think we just do edit new version, add a name, first name, deploy.<br>08:51 If we get any errors, it might be something around the text. We might have forgotten something. Okay, we don't have to update the URL, but we do have to update this here. We're going to add that first name there, next.<br>09:07 Now we, uhm, this is going to be a little funky because we have two input forms Explore how to create and manage forms in Google Sheets. Opens in new tab . We have a label Learn how to use the query label clause for better data presentation. Opens in new tab .<br>09:14 Let's add a label Learn how to use the query label clause for better data presentation. Opens in new tab here as well.
We need to do command enter to get a new line, label Learn how to use the query label clause for better data presentation. Opens in new tab , and let's put it a break so that it does it on a new line into your first name.<br>09:32 Okay, let's take all that text, update this. Next, let's look at it there. Enter your email, enter your first name.<br>09:41 There are these quotes. You know these quotes come from copying the, from the sheet. We can delete those quotes. Next, there.<br>09:49 Enter your email, enter your first name, save. Let's publish Discover how to publish your Google Sheets and Apps Script projects. Opens in new tab . We don't want to review publish Discover how to publish your Google Sheets and Apps Script projects. Opens in new tab and changes. We just wants you.<br>10:02 Hit publish Discover how to publish your Google Sheets and Apps Script projects. Opens in new tab . Publish Discover how to publish your Google Sheets and Apps Script projects. Opens in new tab . View. And now let's see if it works.
Enter your email, andy at gmail dot com. Andy, that's not my email.<br>10:15 Let's see if we've, you've successfully registered. And in our emails. Oh, we have done something wrong in our, um, Apps Script Explore Google Apps Script to enhance your Google Sheets functionality. Opens in new tab .<br>10:30 Let's look at our Apps Script Explore Google Apps Script to enhance your Google Sheets functionality. Opens in new tab . And see, we have, I think we deployed it. Params dot first name.<br>10:52 We have a third, right here, so, what is going on? It might be in the JavaScript. script. Oh, you know what?<br>11:07 I did forget one thing, here. Before this first name, I think we need an ampersand. That's what we need.
Forgot that one.<br>11:18 Little bit to separate the email and the first name. Okay, let's go update this code, here. Next. Save.<br>11:30 Oh, and let's get rid of those quotes, just so that it's cleaner. Just the double quotes, and just from copying from the Google Sheet.<br>11:40 Let's hit publish Discover how to publish your Google Sheets and Apps Script projects. Opens in new tab . This will work now. View. We are going to open yet another one. Let's enter email andyfranklin at gmail.com andy, with a capital A.<br>11:56 Let's If that works, submit. You have successfully registered your email. Great. Let's go check our emails. Perfect.
It's working now.<br>12:06 Now we have separated the email and the first name. Awesome. So that's how you add more stuff if you want to capture things.<br>12:14 So all of those parts in summary are update your, uh, Apps Script Explore Google Apps Script to enhance your Google Sheets functionality. Opens in new tab , this do post, create a parameter Dive into the concept of parameters in programming and scripting. Opens in new tab here.
This parameter Dive into the concept of parameters in programming and scripting. Opens in new tab name, params.firstname is going to be equal to this code in here where Learn how to filter data using the query where clause in Google Sheets. Opens in new tab you need to put an input name equals, and maybe put a.<br>12:32 Uh, line break to break it up so you can see them all, and then also add this form dot, whatever the parameter Dive into the concept of parameters in programming and scripting. Opens in new tab name is, dot value, and include it in the URL that you're sending to your Apps Script Explore Google Apps Script to enhance your Google Sheets functionality. Opens in new tab .<br>12:47 There you go. That is it. Pretty simple. Hopefully, uh, it's simple for you, but that's how you embed a name and any number Understand number formatting and functions in Google Sheets. Opens in new tab of names.<br>12:54 You can add first name, last name, maybe even some extra information.
there are some different types of inputs you can add like checkboxes.<br>13:02 And just, you just need to figure out, and you can do this very quickly through ChetGPT, but basically say, hey, I have this, uh, HTML, uh, input, which is a checkbox Discover how to use checkboxes in Google Sheets for data entry. Opens in new tab , so it has a value of either true or false, uhm, what is the value here that it's going to be?<br>13:17 Maybe probably just true or false, but you can double check those different Parameter Dive into the concept of parameters in programming and scripting. Opens in new tab types with Chet GPT should be pretty quick to figure out what JavaScript you have to add here form dot The name of it dot value.<br>13:32 What is it?
Are you going to get? All right. Hopefully that's helpful to you. If you're watching this on, uh, better sheets down below, is this app script Explore Google Apps Script to enhance your Google Sheets functionality. Opens in new tab here in the sheet?<br>13:41 You can get this for free. If you're not yet a member of better sheets, become one today and grab the very handy dandy into your script and get the, uh, URL here.<br>13:52 URL HTML. Thanks. Bye.</div>
Courses
Find "Entry Number" for Bookmarklet
00:07:26
Embed Email Form and Name Form into Website to Google Sheets
Let's Make a Bookmarklet!
00:12:37
Redirect a Domain to a Google Sheet
00:01:57
How to Download a Sheet as a CSV with a URL only
00:04:22
Create a Vote Button from Google Sites to Google Sheets
Automatic Screenshots in Apps Script
Add NPS to Your Google Site
Add Tasks to Google Tasks From Google Sheets
Create an Internal Google Sheets Add-on
How To Export Your Beautiful Sheets to PDF
00:04:06