Hey there stranger!

Sign up to get access.

Spreadsheet Automation 101 Lesson 3: MailApp

About this Tutorial

Learn about the needed variables for the Mail App to work. In this lesson, I’ll walk you through how you can email yourself or other people the items in a to-do list that hasn’t been done yet.

Video Transcript

0:00 All right, in this video I'm gonna introduce you to Mail app, because that's the function inside of Google Sheets and App Script that allows us to email either other people or ourselves.
0:12 And it's gonna be in the next video. The key part and it's fairly simple, so I really wanted to get through this to you very quickly in one little module, so function, we're gonna write this function email.
0:27 Actually the point of what, what we're doing is we're gonna email anything that's not done. So let's see, email let's just call it not done, <laugh>.
0:35 And we want to use some brackets here. Now, what do we want to email? It doesn't really matter right now as I introduce Mail app.
0:43 So all this is gonna do is gonna do mail app with a capital m, capital a dot. And we only have two options here.
0:50 So we're gonna use select send email. Now within Insent email, we have a lot of different options, but I'm not gonna go too far into that.
0:59 We could go to mail app Google App script here. Let me show you this a little bit. And in this an email, we have four options here.
1:11 We're just gonna use the second one because it is the simplest one. We, we need just a recipient, a subject, and a body.
1:18 We can go deeper into the other ones, but this one is simple and I use it all the time. So what do we need?
1:24 We need a recipient, comma, a subject, and a body. What are these things? These things are variables. Now what we could do is write just string variables right here to start off with, to make sure this works.
1:36 So we need a variable called recipient or rec. And we're gonna do andrew@bettersheets.com, right? That's my own email address. You can use your own email address if you're following along with this video.
1:48 We need a subject we're gonna do equals hello with one Oh. We need a body variable. Body equals hi. Well, we can do Hello world, right?
2:04 So we save this. Now we're gonna run it. Once we run, we choose this the correct Email. Email not done.
2:10 Run it. We're gonna need some authorization. We do this authorization because we are using mail app right now. When you look at all these authorizations, you'll see this send email as you, that's the mail app of this.
2:23 So we need to allow this we'll look at our email in a sec. And here we go. We got an email from ourselves.
2:33 So what this is, it is sending from, it is sending from the email that is the user of that Google sheet, and then it's sending to whoever I want.
2:43 So I'm actually sending from myself on a different Google account to someone to here on a different Google account. So you can send externally to other people, or you can send directly to yourself.
2:54 It'll just be an email from yourself to yourself. And that's mail app. Mail app Is, is fairly straightforward. You use M A i l with capital M, capital A for app dot send email with capital E, remember, and we have three variables.
3:09 The recipient, the subject, and the body. We delin the limit them, the limit them by the comma, and we can run any kind of variable here.
3:21 Instead of maybe subject or body, we can reference a cell, right? We've already done that. In this course you can reference a cell using spreadsheet app to get the subject, to get the body, and even to get the recipients, which we'll do in the next one.
3:35 What we want to do is we want to go all of these tasks and actually loop through them in that body, right?
3:41 So we'll do that with a four loop next.

Courses

Spreadsheet Automation 101: Introduction to Pre-course Videos

Think Like a Programmer: Develop The Mindset of an Apps Script Coder

Spreadsheet Automation 101: Functions

Spreadsheet Automation 101: Variables

Spreadsheet Automation 101: Dot Notation

Spreadsheet Automation 101: Camel Case

Spreadsheet Automation 101: Parentheses

Spreadsheet Automation 101 Lesson 1: GetValue - Introduction to SpreadsheetApp

Spreadsheet Automation 101 Lesson 1: Spreadsheet Taxonomy

Spreadsheet Automation 101 Lesson 1: A1 Notation vs Row,Column Syntax

Spreadsheet Automation 101 Lesson 1: getActiveSpreadsheet() vs getActiveSheet()

Spreadsheet Automation 101 Lesson 1: onOpen() Trigger - Custom Menu

This Seems Like Automation

Spreadsheet Automation 101 Lesson 2: Get Values - Introduction

Spreadsheet Automation 101 Lesson 2: Arrays

Spreadsheet Automation 101 Lesson 2: For Loop

Spreadsheet Automation 101 Lesson 2: Bracket Notation

Spreadsheet Automation 101 Lesson 2: Logger.log()

Spreadsheet Automation 101 Lesson 2: If ( ){ } and Checkboxes

Spreadsheet Automation 101 Lesson 2: onEdit() Trigger

Introduction to Spreadsheet Automation 101 Lesson 3

Spreadsheet Automation 101 Lesson 3: MailApp

Spreadsheet Automation 101 Lesson 3: Email Yourself For Loop

Spreadsheet Automation 101 Lesson 3: Send Email Every Week Trigger

Spreadsheet Automation 101 Lesson 3: Email Other People For Loop

Spreadsheet Automation 101 Lesson 4: Access APIs Introduction

Spreadsheet Automation 101 Lesson 4: UrlFetchApp

Spreadsheet Automation 101 Lesson 4: OmdbAPI get ApiKey, get Data in URL

Spreadsheet Automation 101 Lesson 4: OmdbAPI get data in Apps Script

Spreadsheet Automation 101 Lesson 4: JSON (beautifier) and OmdbAPI parameters

Spreadsheet Automation 101 Lesson 4: OmdbAPI Parameter Picker

Automatically Clear Content | Refresh Reuse Recycle Templates

Automate Google Sheets With Zero Experience

Automatically Uncheck A Daily Checklist

Activate A Certain Sheet When Opening a Spreadsheet