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.
- Node.js installed
- Clasp (Command Line Apps Script Projects) installed globally:
npm install -g @google/clasp
Log in to Clasp if you haven't already:
clasp loginCreate 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.templateto.clasp.jsonand insert your existing script ID:cp .clasp.json.template .clasp.json # Edit .clasp.json with your scriptID
Push the local .js files to the Google Apps Script environment:
clasp pushThis 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.
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.
- Open the project in the browser:
clasp open
- Navigate to Project Settings (gear icon on the left sidebar).
- Scroll down to Script Properties and click Edit script properties.
- 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.
You can execute the summary via:
- Manually: Using the Apps Script editor, select the
agendaEmailfunction 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
agendaEmailon 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.)