Skip to content

lucienve/calendar-event-summary

Repository files navigation

Calendar Event Summary

This is a Google Apps Script project that pulls events from a specified Google Calendar for the upcoming week and sends a summarized email. It natively formats the events, handles "All Day" events properly, and attaches a PDF of the agenda to the email.

Setup Instructions

1. Prerequisites

  • Node.js installed
  • Clasp (Command Line Apps Script Projects) installed globally:
    npm install -g @google/clasp

2. Authentication

Log in to Clasp if you haven't already:

clasp login

3. Initialize or Link the Project

Create a new standalone Apps Script project or link an existing one:

  • Option A (Create new):
    clasp create --type standalone --title "Calendar Event Summary"
  • Option B (Link existing): Copy the .clasp.json.template to .clasp.json and insert your existing script ID:
    cp .clasp.json.template .clasp.json
    # Edit .clasp.json with your scriptID

4. Push Code to Apps Script

Push the local .js files to the Google Apps Script environment:

clasp push

Automated Deployment (Optional)

This repository includes a GitHub Actions workflow (.github/workflows/deploy.yml) that can automatically push changes to Apps Script. To use it, you must configure the following Repository Secrets in your GitHub repository (Settings > Secrets and variables > Actions):

  • SCRIPT_ID: The ID of your Google Apps Script project.
  • ACCESS_TOKEN, ID_TOKEN, REFRESH_TOKEN, CLIENT_ID, CLIENT_SECRET: OAuth credentials required for clasp to authenticate headlessly.

Configuration

This script fetches configuration values dynamically from Apps Script Properties rather than relying on hardcoded variables. You will need to configure these properties on the Google Apps Script dashboard.

  1. Open the project in the browser:
    clasp open
  2. Navigate to Project Settings (gear icon on the left sidebar).
  3. Scroll down to Script Properties and click Edit script properties.
  4. Add the following keys and your specific values:
Property Description Example Required
CALENDAR_ID The ID of the Google Calendar to summarize. your-id@group.calendar.google.com Yes
EMAIL_DEST The target email address or mailing list to send the report to. newsletter@yourdomain.com Yes
TIMEZONE Custom timezone string for date parsing/formatting. America/New_York No

If TIMEZONE is not specified, it will default to America/New_York.

Running the Script

You can execute the summary via:

  • Manually: Using the Apps Script editor, select the agendaEmail function from the dropdown and click Run.
  • Scheduled Trigger: In the Apps Script dashboard, navigate to Triggers (clock icon), and create a new Time-driven trigger to run agendaEmail on a schedule (e.g., Weekly on Sundays at 8:00 AM).

(Note: On the first run, Google will prompt you to authorize permissions for Calendar and Mail.)

About

Summarize events in a Google Calendar into an email with an attached pdf

Topics

Resources

License

Stars

Watchers

Forks

Contributors