Henrique Couto

Engenheiro de software frontend

profile picture

Google App Script Calendar Sync

This project allows you to sync events in two calendars (e.g. Work Calendar and Personal Calendar).

How to use

  1. Share and subscribe your calendars with each other; (You can follow instructions in Google Help for Share and Subscribe).
  2. Create a new project in Google Apps Script;
  3. Create two files with content in main.gs and config.gs;
  4. In config.gs file add the Calendar Id you want to keep synced. (e.g. [email protected])

Habits

You can create Habits (e.g. Lunch Time, Focus Time) that will sync, but the script will keep the original title of the event.

To define your habits, just open the config.gs file and update the habits array.

1const habits = ["🍝 Lunch Time", "🧐 Focus Time"];

With the habits setup done, just create events in your calendar with the same title you defined in the habits array.

Automated sync

To keep the calendars in sync you need to create a trigger that will run the script.

In the triggers tab in your Google Apps Script project, add a new trigger to run StartSync.

You can select the options you prefer, but it is recommended that you use the options as follows:

Select event source: Time-driven
Select type of time based trigger: Minutes timer
Select minute interval: Every 10 minutesOr greater

Thanks

This script is created based on this gist file.

Know more

  • calendar
  • google-apps-script
  • google-calendar
  • sync