Calendoo – a Google Apps Script

Google Apps Script
Google Apps Script

Recently I discovered Google Apps Script, a comprehensive system for automating your Google accessories (Gmail, Drive, Calendar, Tasks, etc.).  It includes a web IDE for writing JavaScript code and easy-to-use API’s for each Google accessory.  When you finish writing your scripts, you can save them to your Google Drive and set up triggers to have them run automatically.  Within a few hours of discovery, I had written my own Google Apps Script, which I will now share with you.

First a little background on the problem I needed to solve.  I use the Google Calendar extensively.  In addition to the regular events I put on my calendar (lunch with friends, doctor appointment, anniversary), I also put reminders for tasks that need to get done.  I realize that Google already has a Tasks list for this very purpose.  Call me crazy but I find it easier to whip out the Calendar app on my phone and insert a new event.  The only problem is that I also procrastinate.  Weeks will go by and the task’s calendar event is still languishing on my Calendar.  At the end of every month, I have to clean up my Calendar and decide which tasks are actually important or not.  The ones that are all have to be moved to the next month.

Enter my new Google Apps Script, Calendoo.  Calendoo looks at yesterday’s calendar events and either advances them into the future, if they’re important, or moves them off the Calendar and into a Tasks list (called TasksFreezer), if they are unwanted.  In order for Calendoo to recognize which events belong where, you simply add a Calendoo symbol in the name of your calendar event.  The Calendoo symbols are as follows:

:. (colon period) = Unimportant event, advance yesterday’s unimportant events to next month.

:! (colon exclamation-point) = Important event, advance yesterday’s important events to today.

:? (colon question-mark) = Semi-important event, advance yesterday’s semi-important events to next week.

:- (colon dash) = Unwanted event, take it off the calendar and put it in the TasksFreezer Tasks list.

:+ (colon plus) = Wanted task, take it off the TasksFreezer Tasks list and put it on the calendar today at noon.

If you want to use the Calendoo script, read on for an explanation of how to set it up.

Google Apps Script: Make a copy
Google Apps Script: Make a copy

1. Import the script into your own Google Drive

Click on the link at the bottom of this blog post.  The Google Apps Script IDE page should open up showing the Calendoo code.  Click the [File] menu and choose [Make a copy].  The Calendoo script should be downloaded to your own Google Drive.  Access it by going to  The Calendoo script file should be in your root folder.  Click on it to open it.  At this point, you may have to go through a wizard for installing Google Apps Scripts in Google Drive if this is your first time using them.  The Google Apps Script IDE should open again, this time with the Calendoo script installed in your own Google Drive.

Advanced Google Services Dialog
Advanced Google Services Dialog

2. Set up APIs and Permissions for the script

Next, click on the [Resources] menu and choose [Advanced Google services].  An Advanced Google services dialog will appear.  Next to Tasks API, click the radio button to turn it on.  This allows the code to access Tasks API functionality (used for managing Task lists in your calendar).

Google Developers Console Page
Google Developers Console Page

Now you will need to enable the services.  Click the [Google Developers Console] link at the bottom of the dialog.  The Google Developer Console website should open.  In the list of APIs, click the radio buttons next to Calendar API and Tasks API to turn these services on.  Now close the Google Developers Console page and the Advanced Google services dialog.

Run the processEvents Function
Run the processEvents Function

Back in the Google Apps Script IDE, we need to run a function in the Calendoo script so it can request permissions from you the user (yes, this step is a little strange, I know).  Click on the [Run] menu and choose the [processEvents] function.  A dialog will appear saying, “This app would like to: manage your calendars, manage yours tasks, view your tasks”.  Accept the dialog and it will close.  The Calendoo app is ready for action, we just need to pull the trigger.

3. Set up a trigger for the script

Current Project's Triggers
Current Project’s Triggers

To create a trigger to run the script periodically, click on the [Resources] menu and choose [Current project’s triggers].  A dialog will appear with a link, “No triggers set up. Click here to add one now”.  Click on that link.  The dialog will now show the options for our new trigger.

New Project Trigger
New Project Trigger

Choose to run the processEvents function.  This is the main function that drives the entire Calendoo script.  Make the event Time-driven and set it to run everyday at Midnight to 1am.  This will cause the processEvents function to be executed everyday at midnight, pushing yesterday’s events forward.  Click Save.  The Calendoo script is now completely configured for your Google account.  Hurrah!

I hope you enjoy the Calendoo script.

Click here to view the Calendoo script and use it for your own Google Calendar.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s