A simple shared TODO list with daily email summaries in Google Apps

Last time I gave an example of email notification workflows using Google Apps. This time we’ll extend the email sending capability of Google Apps with another real-life example: a shared Google docs TODO list.

Suppose you and your team use a simple shared Google spreadsheet to help manage tasks that need to be performed:

todolist

Team members add and remove tasks to the shared list throughout the day as they complete their work. At the beginning of each day, it would be nice to have a summary email in everyone’s inbox of what they need to work on each day. This would save each person the time of looking through the list of tasks for items that belong to them. Luckily, this is pretty easy to create with a little Google Apps Scripting.

function sendTodoReminderEmails() {

 var ss = SpreadsheetApp.getActiveSpreadsheet();
 var sheet = ss.getSheets()[0];

 // get all the data in spreadsheet
 var range = sheet.getDataRange();
 var values = range.getValues();

 var todo = {};
 
 // Column A is task, column B is person's email, assumes header row in table
 for (var row = 1; row < values.length; row++) {
   var task = values[row][0];
   var email = values[row][1];
   
   if (!todo.hasOwnProperty(email)) todo[email] = [];
   todo[email].push(task);
   
 }
 
 //send out summary emails
 for (var email in todo) {
   var emailBody = 'Hey! Here are your current tasks:\n\n';
   for (var task in todo[email]) {
     emailBody += todo[email][task] + "\n"
   }
   MailApp.sendEmail(email, 'Your daily todo list', emailBody);
 }

}


Add the above code by clicking "Tools", "Script Editor" in your Google Spreadsheet. Then, click "Resources", "Current Project's Triggers", to set up this function to run daily at 6am:

dailyemailtodotrigger

Now, every day in your inbox you'll get emails like this:

todoemailinbox

Cool!

Leave a Reply

Your email address will not be published.