Members-only tutorial
Watch the video and get the practice sheet with membership.
About this Tutorial
Video Transcript
<div>0:00 So in this earlier video, we created a bunch of tasks and then we emailed ourselves or someone else, all the tasks that aren't done.<br>0:09 Well, what if we have multiple people we wanna send emails to? So I created another tab called emails and I have a list of email addresses Learn about email addresses and how to manage them in your spreadsheets. Opens in new tab .<br>0:17 This is all the same, my own email address, just with some dots in it. Now how do we send the same email to all those different people?<br>0:25 Well, we use the same four loop, a similar thing with the four loop.
So just to re re review, we are sending the recipient only one time here to one email address as text.<br>0:37 We'll change that. We're sending them the subject tasks not done, and then we're sending them the array of not done tasks.<br>0:46 We're using this four loop here to figure out which ones we're sending and then we're using this line of code that the whole thing hinges on this one line of code, which is send to a recipient, the subject and the body, which is not done tasks.<br>1:01 Okay?
So what we need to do is actually put this mail app, the whole reason we have everything above it into a for loop and get the array of all of the emails that we got.<br>1:14 So same thing we do here. We're going to do variable. Let's do this, let's bring this up. We're gonna do variable emails equals or is spreadsheet Understand the basics of spreadsheets and their functionalities. Opens in new tab app.<br>1:28 We wanna do the e sheet name Discover how to reference and use sheet names in your formulas. Opens in new tab is emails, I do believe emails a, let's just do exactly what we have a one to a four, A one, A four before we do anything else, right?<br>1:45 We can log this logger dot log email list. Let's see what that is.
Let's comment Find out how to add comments to your spreadsheet for better collaboration. Opens in new tab out the mail app. So we're not sending emails, but we'll just see what that email list looks like.<br>1:59 We'll run email. Not done. Here we go. So we got an array of arrays Explore arrays and how they can simplify data management in spreadsheets. Opens in new tab . So all we need to do is get first array part, right?<br>2:08 We can also log those. Let's just log it just to be sure we got it correct. We'll do email list with bracket notation Get familiar with notation used in spreadsheets for referencing data. Opens in new tab as we learned before.<br>2:16 We'll do zero. We'll also do just one. We'll just copy paste this just to double check that we're getting the right thing.<br>2:24 We got the right brackets in the right place. We'll do run.
And there we go. We got Andre. Different email addresses Learn about email addresses and how to manage them in your spreadsheets. Opens in new tab .<br>2:33 Perfect. So now let's get this into the four loop. Okay, four I equals zero I is less than email list.email list dot length.<br>2:52 We'll do another semicolon and I plus plus. We'll put in brackets. Let's put that bracket up there. We want to send this email and we have variable recipient.<br>3:08 Maybe we'll write email here. Email, we'll change. Maybe we'll change that. Variable r e c. Just make sure that it is changed to email.<br>3:20 Well, what is that variable? It's email equals email list with BRCA notation Get familiar with notation used in spreadsheets for referencing data. Opens in new tab .
I, okay, so ideally, right we are moving all this just a little bit in, tab it in a little bit so it's easier to read.<br>3:37 We can log the whole list. We can get rid of that log, save it. We're getting all of the emails.<br>3:43 And then we're gonna send an email to each one. And that should end up in our sent. So let's say run.<br>3:49 See if we get any errors. Parameters Learn about parameters and their role in functions and methods. Opens in new tab , number Understand how to work with numbers in your spreadsheet calculations. Opens in new tab string Discover how to handle strings and text data in your spreadsheets. Opens in new tab string Discover how to handle strings and text data in your spreadsheets. Opens in new tab . Don't match Learn about matching data in spreadsheets for effective data analysis. Opens in new tab the method. Signature sent. Email line 20. What does that mean?<br>4:03 The parameters Learn about parameters and their role in functions and methods. Opens in new tab number Understand how to work with numbers in your spreadsheet calculations. Opens in new tab String Discover how to handle strings and text data in your spreadsheets. Opens in new tab . String. Oh, might be because we need to add a zero.
If it looked like those things we logged were actually still arrays Explore arrays and how they can simplify data management in spreadsheets. Opens in new tab and not a string Discover how to handle strings and text data in your spreadsheets. Opens in new tab .<br>4:16 So let's see if we just add this BRCA notation Get familiar with notation used in spreadsheets for referencing data. Opens in new tab zero at the end. So it's the first item, which is an array.<br>4:23 It might only be one item array. We might need to get that one item there. So let's see if that fixes it.<br>4:29 Perfect Execution completed there and they do exist all in our sent folder. Perfect. So we've sent emails now to a bunch of people.<br>4:41 Well, it's all us. We sent those emails to ourselves. But this is a great way.
So you can create a list of emails.<br>4:49 You wanna send maybe a report to every month or every week or every day. I don't know how many people you have to report to.<br>4:56 There are some additional things you can do here that I won't go into this video and won't be in this course, but you can add CC bcc.<br>5:05 You can do some pretty cool things with this mail app and email system. So I hope you can email lots of people the reports that you have to email them anyways, get a lot of stuff done.<br>5:15 Things are watching.</div>
Courses
Spreadsheet Automation 101: Introduction to Pre-course Videos
Think Like a Programmer: Develop The Mindset of an Apps Script Coder
How To Change Date Format Automatically
Tips to Navigating Thousands of Lines of Code In Apps Script
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
Scoping Functions in Apps Script
Breaking Through Errors In Apps Script
VAR vs CONST vs CONSTANT in Apps Script