Skip to content

Lightweight Gmail filter automation using Apps Script (clasp): label Cognos reports and auto-archive. This addresses a limitation of default Gmail filters.

License

Notifications You must be signed in to change notification settings

AlvaroGomezMartinez/gmail-filters

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gmail Filters Project

Automation for labeling Gmail threads related to NAHS & NAMS Cognos Attendance/Enrollment reports. This script addresses a limitation of Gmail filtering that doesn't filter emails when the subject is the same, but the attachments have different names. For example, if an email's subject is, "A new version of My Alt HS Attendance/Enrollment Count is available", but the attachment is named either "My Alt MS Attendance/Enrollment Count" or "My Alt HS Attendance/Enrollment Count", this script will look at the title of the attachment and add the appropriate label to the email.

Script/Function

  • labelCognosReports()
    • Searches unread threads matching the report subject and applies a label depending on attachment file name.
    • Moves threads to archive and marks them as read.

Usage

(Preferred Method) Set to Run on Triggers

  1. Open the Google Apps editor for this project,
  2. Select the Triggers icon,
  3. Click on the blue + Add Trigger button on the bottom right,
  4. Create a separate trigger for each day of the week you want the function to run (i.e., Mon-Fri)

Add Trigger for Gmail-filters

Make the following selections under each of the following headings:

Choose which function to run

labelCognosReports

Choose which deployment should run

Head

Select event source

Time-driven

Select type of time based trigger

Week Timer

Select day of week

If you intend to run this script every day of the work week, start with Every Monday, then when you create the next four triggers pick the following day of the week.

Select time of day

Choose which ever time block you want the script to run.

  1. Click Save
  2. Create another trigger for the following day of the week. Do this until you have created all five triggers, one for each day of the week.

(Optionally) Manually Run the function

  1. Open the Apps Script editor for this project,
  2. Choose labelCognosReports from the function dropdown,
  3. Click Run, then view logs under Executions.

Notes

  • Labels are created on-the-fly if they don’t exist.

About

Lightweight Gmail filter automation using Apps Script (clasp): label Cognos reports and auto-archive. This addresses a limitation of default Gmail filters.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published