0:00 Hi, so in this video I'm going to show you how to send an email when a Google form is filled out with the Form entries now you might be thinking oh, I already do that I get an email from Google It tells me I have filled out a form and or someone has filled out a form and that is true But I want to make
0:16 that email a little bit better, so if we go up to Tools, create a new form And we're going to create a new form, and we're just going to say it's some kind of like Entry for people to sign up for some event right so we'll have some short answers We'll have a name, and we'll have let's make another thing
0:38 and say occupation Okay, so that's two items. We can add more and more if we want and actually it does not matter How many items there are we can get them all with the code that I'm going to show you okay, so in settings you can Do something where you get out here responses?
0:58 You can say hey email me Get email notifications all right. Let's go look at what that looks like so I filled out the form and here It says one response it says Your form has a new response and in order to see What is in there?
1:15 I have to go to this which I have to go to responses and be like okay? There's one response response great actually just hi hi let me do again another one another one occupation doctor submit and now I have this and it looks fine if it's only one or two or three but when it gets more and more this is
1:38 going to be very very hard to look through and see individual people I have to click through these one through two maybe 200 I want them in my inbox and I want them in a nice like table so what I have done in Apps Script is already wrote this function for you so you can copy this sheet you can copy this
2:02 uh code I'll put it up at apps uh better sheets.co slash snippets as well and what it does we'll walk through it is first it is a named function which we'll deal with how to trigger this later uhm but we'll we get the form values we create a table in html and for every single value we get both the key
2:25 and the data which means the question and the answer and then we build a table and we send an email with a subject form submitted with a date so that we can do this multiple times during the same day we are sending an email to to the owner of this spreadsheet we can enter any email we want and actually
2:44 this is one of the most important parts of this is that you can set this particular email who it's to to a number of individuals at your company, business, or yourself and an assistant or just the assistant you can edit this sheet owner email and then we have use mail app here.
3:01 We can also use gmail app but right now we're just going to use mail app. Okay, how do we trigger this?
3:07 How does um this trigger that? Well, we're gonna first not get the email notifications of new responses. We're gonna cut that off and then once we're save this, we're going to go over here to triggers on the left.
3:25 We're gonna create a new trigger and I'm gonna choose which function to run. If you have other functions, you'll have to select it from here and we are going to save event source from spreadsheet and event type on form submit.
3:37 That is it. Save that. And we'll have to authorize it. But once it's saved, let's let's fill out this this again.
3:49 Let's submit another response and let's see what happens. Let's call hello and doctor again. Submit. So let's see Let's go look at our email.
4:01 And this is the email we got. It says form submitted and it has a time stamp of when that form was submitted, name, and the occupation.
4:09 So all of the information from that form is right here in our inbox. This is fantastic. I do not have to go back to our form responses here and check what's going on.
4:20 What is the data? I do not have to look through this summary, these responses, these questions. It's all in one package in my inbox so I can search through it.
4:30 Maybe you want to put a keyword in the subject. Maybe you want to put some other information here. For instance, we may want the URL of this email.
4:40 The sheet. So let's add that actually in this video. So here we have this HTML. We're going to add another line HTML plus equals and we are going to say uhm sheet URL.
4:58 and actually we want to write a little bit of HTML here. We're just going to do P and then this plus sheet and then at the end plus and in quotes again and in quotes again we're going to end that P.
5:22 So that's just a little bit of HTML, paragraph, um we're going to write sheet and then put the sheet URL here.
5:28 What's the sheet URL? Let's get it. Variable sheet URL equals. I think we can just grab this instead of retyping it.
5:37 Get sheet. Hmm. Let's actually get active sheet. Get sheet. Ah, what it is, is get. Get active spreadsheet. Get active.
6:00 URL. There it is. Not sheet URL. Get URL. And so this sheet URL will be in the email. Let's save this and go submit another response and check.
6:11 So we go, howdy, yo. And here we go. We're done. We're going to see if this shows up. We have a new email and now we have the sheet that it's selected.
6:25 So we have the actual sheet that we can get to immediately if we want any more information here. And I want to show you that this is, this code doesn't need to be edited if you want to add more things.
6:35 So let's add a few more items, a few more questions. Let's add a question, how are you today? We can even say okay, add option, good.
6:52 Okay, let's go to the sheet form rather let's say you're name is hula boy, how are you doing? Okay, occupation, hulaing, submit.
7:10 And already we have the email, we have the name, the time stamp, the occupation, are you okay, and the sheet. So we did not have to edit the code.
7:20 Even if we added more items to the form, which makes this really, really flexible and very, very easy. So here we see all these. So this adds another function, another option for you, instead of these uh response emails.
7:35 Up here, get email notifications for new responses. You can also have that if you want, but I like this much better.
7:40 It is much more flexible. We can add more HTML to this, more styling if we want. Uh you can add more things like the sheet, add more items easily, all types of stuff.
7:51 I hope this makes sending emails when your form is filled out much, much easier for you and much better for you.