Google app
Gmail
GmailApp scripts can send messages, search threads, apply labels, and read attachments after you approve Gmail access for the project.
Choose a task using GmailStart with an outcome
Tasks that use Gmail
Choose the result first. Each card opens a step-by-step guide.
- Gmail Send an email for each row in a Google Sheet
Send one email to each person listed on a Customers tab. The script marks each row Sent as it goes, so a later run sends only to rows that are not marked yet.
- Gmail Send an email when a status changes
Email the person on a row whenever the status in that row changes. One installed trigger covers every tab in the spreadsheet, including tabs you copy later.
- Gmail Save labeled Gmail attachments to Drive
Copy the attachments from chosen Gmail conversations into one Drive folder. You pick the conversations by adding a label to them, and the script saves every attachment it finds there.
- Gmail Label emails from one sender in Gmail
Put a Gmail label on every conversation from one sender, such as a newsletter, a few at a time. The script creates the label if needed and skips conversations that already have it.
- Gmail Log new emails to a Google Sheet
Keep a list of recent emails in a spreadsheet, one row per message with the date, From address, subject, and a link. A message ID column keeps a second run from adding the same message twice.
- Gmail Email a Google Doc as a PDF
Send a Google Doc to someone as a PDF attachment. Paste the file ID of the Doc into the script, and it builds the PDF and emails it. The Doc itself is not changed.
- Gmail Email yourself a weekly sheet summary
Get a short email every Friday with the numbers from an Orders tab: how many rows it has, the total of column C, and how many rows are not Done. Run the setup function once to install the weekly trigger.
- Gmail Email yourself tomorrow's calendar agenda
Get an email each evening listing tomorrow's events on your main Google Calendar. Run the setup function once to install the daily trigger.
- Gmail Run an Apps Script function every day
Make a function run on its own once a day. Run the setup function once, and from then on Apps Script calls the reminder function each day around the hour you chose.
- Gmail Respond to a Google Form submission
Get an email every time someone submits your Google Form, listing each question and its answer. The email goes only to you, the owner of the script.
- Gmail Send a confirmation to the form respondent
Send each person who submits your Google Form a short thank-you email that repeats their answers. The form must collect verified email addresses.
- Gmail Check a website and alert when it is down
Get one email when a website stops answering and one when it is back. An hourly trigger fetches the address, and a saved script property stops the script from emailing you every hour during one outage.
Snippets
Snippets for Gmail
Complete functions you can paste and run one at a time.
Object reference
Objects available in Gmail
Open an object when you need to get it, try a common action, or inspect exact method signatures.
- Object reference Gmail thread
A GmailThread is one Gmail conversation. Get threads with GmailApp.search() or label.getThreads(), then call getMessages() or addLabel().
- Object reference Gmail message
A GmailMessage is one email inside a Gmail thread. Call getFrom(), getSubject(), getDate(), getPlainBody(), or getAttachments() to inspect that single message.
- Object reference Gmail label
A Gmail label is a tag you can apply to conversations. A script can look one up by name, and can add or remove it from threads.