Skip to content

ArtyMcLabin/GoogleCalendar_ExtendedFeatures_Appscript

Repository files navigation

Google Calendar Automation Scripts

Note: This README was AI-generated and reflects the current state of the automation scripts.

A collection of Google Apps Script automations to supercharge your Google Calendar with smart features like prefix-based coloring, intelligent meeting detection, and container-based event grouping.


✨ Features

🎨 Prefix-Based Event Management

Quickly format events with simple prefixes that auto-remove after processing:

Prefix Effect Example
o Orange color o client meeting β†’ Orange event titled "client meeting"
r Red color r urgent deadline β†’ Red event titled "urgent deadline"
y Yellow color y brainstorm session β†’ Yellow event titled "brainstorm session"
f Free time (transparent) f optional lunch β†’ Event marked as "Free"
daily Daily recurrence (no end) daily standup β†’ Repeating daily event titled "standup"

All prefixes are case-insensitive: O , R , DAILY work just as well!


🀝 Smart Meeting Detection

Automatically detects and enhances meeting events:

Detection criteria:

  • Keywords in title: meet, meeting, call, go, train, ride
  • Meeting platforms in description/location: Google Meet, Zoom, Webex, GoToMeeting, Calendly, Zeeg
  • Events with attendees
  • Events already colored red

Auto-enhancements:

  • βœ… Colors meeting RED
  • βœ… Adds 3-minute reminder (preserves your other reminders)
  • βœ… Smart detection (won't remove manually set reminders)

πŸ“¦ Glue Events (Container System)

Move multiple events together like a folder!

How it works:

  1. Create an event with "glue" anywhere in the title (e.g., Glue morning routine)
  2. Create events inside the glue's time window (e.g., workout 9:00-9:30, breakfast 9:30-10:00)
  3. Move the glue event β†’ all contained events move with it!

Features:

  • βœ… Auto-capitalizes "glue" β†’ "Glue"
  • βœ… Automatically colored GRAY
  • βœ… Marked as "Free" time (doesn't block calendar)
  • βœ… Position-based detection (no manual attachment needed)
  • βœ… Maintains relative positioning when moved

Perfect for:

  • Morning/evening routines
  • Client project blocks (prep β†’ meeting β†’ followup)
  • Travel itineraries (flight β†’ hotel β†’ rental car)

πŸš€ Installation

Prerequisites

  • Google Account with Google Calendar
  • Node.js (v4.7.4 or later)
  • npm (comes with Node.js)

Setup Steps

1. Install clasp (Command Line Apps Script)

npm install -g @google/clasp

2. Enable Google Apps Script API

Visit https://script.google.com/home/usersettings and toggle on "Google Apps Script API"

3. Authenticate clasp

clasp login

This opens a browser window to authorize clasp with your Google account.

4. Clone this repository

git clone https://github.com/ArtyMcLabin/GoogleCalendar_ExtendedFeatures_Appscript.git
cd GoogleCalendar_ExtendedFeatures_Appscript

5. Create your Apps Script project configuration

# Create a new Apps Script project
clasp create --title "Calendar Automation" --type standalone

This creates a .clasp.json file with your new Script ID.

OR if you prefer to use an existing project, copy the example:

cp .clasp.json.example .clasp.json
# Then edit .clasp.json and replace YOUR_SCRIPT_ID_HERE with your actual Script ID

6. Deploy to Apps Script

clasp push

7. Set up Calendar trigger

  1. Open the Apps Script editor:

    clasp open
  2. In the Apps Script editor:

    • Click Triggers (clock icon) in left sidebar
    • Click + Add Trigger (bottom right)
    • Configure:
      • Function: dispatchCalendarUpdates
      • Event source: From calendar
      • Calendar owner: Your email
      • Event type: Calendar updated
    • Click Save
  3. Authorize the script when prompted

Done! Your calendar automation is now active.


πŸ”§ Configuration

All settings are in Code.js under the CONFIG object:

var CONFIG = {
  LOCK_TIMEOUT_MS: 30000,           // Lock timeout (30 seconds)
  MEETING_REMINDER_MINUTES: 3,     // Default meeting reminder time

  COLOR_PREFIXES: {
    ORANGE: 'o ',
    RED: 'r ',
    YELLOW: 'y ',
    FREE: 'f ',
    DAILY: 'daily '
  },

  MEETING_KEYWORDS: ['meet', 'meeting', 'call', 'go', 'train', 'ride'],
  MEETING_METHODS: ['meet.google.com', 'zoom.us', 'webex.com', ...]
};

Customize these values to match your preferences!


πŸ“– Usage Examples

Color Coding Events

Create: "r submit report"
Result: Red event titled "submit report"

Create: "o team check-in"
Result: Orange event titled "team check-in"

Creating Recurring Events

Create: "daily morning review" (9:00 AM - 9:15 AM)
Result: Daily recurring event titled "morning review"

Using Glue Events

1. Create: "Glue project work" (2:00 PM - 5:00 PM)
2. Create: "kickoff meeting" (2:00 PM - 2:30 PM)
3. Create: "development time" (2:30 PM - 4:30 PM)
4. Create: "code review" (4:30 PM - 5:00 PM)
5. Move "Glue project work" to 10:00 AM - 1:00 PM
   β†’ All three events move automatically!

πŸ› οΈ Debugging

Manual Functions (Run from Apps Script Editor)

  • debugShowAllGlueData() - View all stored glue event data
  • clearAllProperties() - Reset all glue tracking data
  • checkAndUpdateGlueEvents() - Manually re-process all glue events

Viewing Logs

  1. Open Apps Script editor: clasp open
  2. Click Executions in left sidebar
  3. Click on an execution to view logs

Note: clasp logs requires GCP project setup (not configured by default)


πŸ”’ Security & Privacy

  • βœ… No hardcoded credentials or API keys
  • βœ… Uses Google's OAuth for authentication
  • βœ… All processing happens in your Google Apps Script environment
  • βœ… No data sent to external servers
  • βœ… OAuth tokens stored locally (.clasprc.json - gitignored)

Script ID in .clasp.json is safe to commit - it's a public identifier, not a secret.


πŸ—οΈ Architecture

Processing Flow:

  1. Calendar event created/modified
  2. Google triggers dispatchCalendarUpdates()
  3. Script fetches recent events (last 30 seconds)
  4. Processes each event based on type:
    • Prefix β†’ Color/settings applied
    • Meeting β†’ Auto-detected and enhanced
    • Glue β†’ Container tracking updated
  5. Results visible in ~15-20 seconds

Key Design Principles:

  • βœ… Idempotent (safe to run multiple times)
  • βœ… No description tag pollution (clean UI)
  • βœ… Event-specific processing markers
  • βœ… 30-second window for rapid event creation
  • βœ… Lock mechanism prevents concurrent conflicts

πŸ“ Development

Local Development

# Edit code in your favorite editor
code Code.js

# Deploy changes to Apps Script
clasp push

# Pull changes from Apps Script (if edited in web UI)
clasp pull

Git Workflow

git add .
git commit -m "Description of changes"
git push

Important: GitHub pushes do NOT automatically deploy to Apps Script. Always run clasp push to deploy.


πŸ› Troubleshooting

Events not processing:

  • Wait 15-20 seconds after creating/editing (trigger delay + processing time)
  • Check executions in Apps Script editor for errors
  • Verify trigger is active

Glue events not moving contained events:

  • Ensure contained events are FULLY inside the glue window
  • Wait 20 seconds after creating each event before moving
  • Run debugShowAllGlueData() to check storage

Lock timeout errors:

  • Multiple triggers firing too quickly
  • Normal behavior - subsequent triggers wait for first to complete
  • If persistent, increase LOCK_TIMEOUT_MS in CONFIG

πŸ“œ License

MIT License - See LICENSE file for details


🀝 Contributing

Contributions welcome! Please feel free to submit a Pull Request.


πŸ™ Credits

Created with assistance from Claude (Anthropic AI) for personal calendar automation needs.


πŸ“Š Version History

Latest: v0.34 (October 2025)

  • Added yellow color prefix (y )
  • Added free time prefix (f )
  • Added daily recurrence prefix (daily )
  • Fixed glue event processing performance (10x faster)
  • Removed description tag pollution
  • Critical lock timeout fix

See commit history for detailed changelog.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors