Giter Site home page Giter Site logo

google-apps-scripts's Introduction

google-apps-scripts

A collection of my Google Apps Script code, primarily for automating Gmail.

  • append_too_old_labels.gs - add a label to old email threads in your inbox indicating how many days old they are.
  • auto_expire.gs - automatically expire emails so they don't spend too long in your inbox.
  • expire_promotions_tab.gs - automatically expire all emails which Gmail categorizes into the "Promotions" tab (combined with auto_expire.gs).
  • log_inbox_count.gs - log the number of threads in your inbox.
  • log_oldest_email_age.gs - log the age of the oldest message thread in your inbox.

Installation

  1. Visit https://script.google.com/ and create a script for "Blank Project".
  2. Paste the file in.
  3. Follow additional instructions at the top of the file, e.g. to set configuration variables.
  4. Click the name "Untited project" at the top of the screen and change it to something descriptive of what the script does.
  5. In the menu at the top of the screen, go to Resources -> Current project's triggers. This is where you will set your script to run regularly. The instructions at the top of the file should indicate which function and how often.
  6. Profit!

google-apps-scripts's People

Contributors

mddub avatar parkr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

loop80

google-apps-scripts's Issues

expiring everything in Promotions tab

I wrote a little function to add expiration labels to everything that comes into my gmail Promotions tab:

var PROMOTION_DAYS = 7;

function addPromotionsExpiration() {
  var filters = [
    'label:Promotions',
    'in:inbox'
  ];

  for (var i = 0; i <= PROMOTION_DAYS; i++) {
    filters.push('-label:x' + i);
  }

  var threads = GmailApp.search(filters.join(' '));

  GmailApp.getUserLabelByName('x' + PROMOTION_DAYS).addToThreads(threads);
}

Once the labels are added the regular stepExpiration function takes over. I have it run every 15 minutes or so.

I went this route because you can't create a filter for things that gmail categorizes into the Promotions tab, unfortunately.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.