This Google Apps Script automates the creation of a structured weekly schedule in your Google Calendar, helping busy families manage their daily routines and activities.
This script creates a week's worth of recurring events in your Google Calendar, including:
- Morning routine (meditation, workout, shower)
- Family meals
- School drop-offs
- Commute and errands
- Day-specific after-school activities
- Evening family time
- Bedtime routines
- A Google account
- Access to Google Calendar
- Basic knowledge of Google Apps Script
- Open Google Calendar
- Click on the three dots next to your calendar name in the left sidebar
- Select "Settings and sharing"
- Scroll down to find your "Calendar ID" (looks like an email address)
- Copy this ID - you'll need it for the script
- Open Google Apps Script
- Create a new project
- Delete any default code and paste the entire script
- Replace
'your_calendar_id'
with your actual Calendar ID (keep the quotes) - Save the project (give it a name like "Family Calendar Automation")
- Select the
createWeekEvents
function from the dropdown menu - Click the "Run" button (
▶️ ) - If prompted, grant the necessary permissions
- Check your Google Calendar to see the created events
To adjust event times, modify the start and end times in the createDailyEvents
function:
// Example: Change meditation to start at 7:00 AM instead of 6:00 AM
var mindfulnessStart = new Date(date);
mindfulnessStart.setHours(7, 0, 0, 0); // Changed from 6:00 AM to 7:00 AM
var mindfulnessEnd = new Date(date);
mindfulnessEnd.setHours(7, 15, 0, 0); // Changed from 6:15 AM to 7:15 AM
To add a new event, use the pattern shown in the existing code:
// Create a new event
var newEventStart = new Date(date);
newEventStart.setHours(21, 30, 0, 0); // 9:30 PM
var newEventEnd = new Date(date);
newEventEnd.setHours(22, 0, 0, 0); // 10:00 PM
calendar.createEvent('Adult Time', newEventStart, newEventEnd, {location: 'Home'});
The script uses a switch statement to assign different activities to each day of the week. Modify these activities by changing the corresponding case:
// Example: Change Tuesday's activity from Art Class to Piano Lessons
case 2: // Tuesday
calendar.createEvent('Piano Lessons', activityStart, activityEnd, {location: 'Music School'});
break;
The script currently sets the event title and location. You can add more details like description or event color:
calendar.createEvent(
'Mindfulness/Meditation',
mindfulnessStart,
mindfulnessEnd,
{
location: 'Home',
description: 'Take 15 minutes to center yourself for the day',
color: CalendarApp.EventColor.PALE_BLUE
}
);
To have this script run automatically every month:
- Click on the clock icon (Triggers) in the Apps Script editor
- Click "Add Trigger"
- Configure:
- Choose which function to run:
createWeekEvents
- Choose which deployment should run:
Head
- Select event source:
Time-driven
- Select type of time based trigger:
Month timer
- Select month of month:
1st
- Select time of day: (choose a time like 2:00-3:00am)
- Choose which function to run:
- Click Save
The script doesn't currently account for holidays or special days. Consider adding:
function isHoliday(date) {
// Add logic to detect holidays
return false;
}
// Then in createDailyEvents:
if (isHoliday(date)) {
// Create holiday-specific events instead
return;
}
- Check that you used the correct Calendar ID
- Verify you granted the script permission to access your calendar
- Check for any errors in the Apps Script execution log
- Open the View menu and select "Execution log" to see details about errors
- Common issues include:
- Invalid calendar ID
- Time zone issues
- Exceeding quotas (too many calendar operations)
- Run at Low-Traffic Times: Schedule the script to run during off-hours
- Make Incremental Changes: Test any modifications on a test calendar first
- Clean Up Before Rerunning: Consider adding a function to delete previous events before creating new ones
- Comment Your Code: Add comments if you make changes to remember your customizations
This script is provided as-is for personal use.