Skip to content

Instantly share code, notes, and snippets.

@vaurora
vaurora / block_personal_appts
Last active March 29, 2023 15:11 — forked from ttrahan/block_personal_appts
Google Apps Script to automatically create, edit and delete events on work calendar for personal calendar events. Instructions on how to set up can be found at https://medium.com/@willroman/auto-block-time-on-your-work-google-calendar-for-your-personal-events-2a752ae91dab
function sync() {
// CHANGE - id(s) of the secondary calendar to pull events from
// If you have more than one calendar, use the form ["XXXXXX", "YYYYY"]
var ids=["XXXXXXXXXX"];
var today=new Date();
var enddate=new Date();
enddate.setDate(today.getDate()+7); // how many days in advance to monitor and block off time
@vaurora
vaurora / CalendarSync.js
Created July 25, 2024 17:48 — forked from ojwoodford/CalendarSync.js
Sync events from a personal Google calendar to a work Google calendar
function SyncMyCal() {
var options = {
'targetEventTitle': "Busy (sync'd event)", // What event title do you want ported events to have
'daysahead': 60, // How many days ahead do you want to sync events over
'ignorealldayevents': true, // Do you want to ignore all day events in your "from" calendars
'ignorethesedays': [0, 6], // Are there days of the week you don't want to sync? 0 = Sunday
'maxhoursbetweenruns': 1, // How many hours between scheduled runs of the calendar sync (you need to set these up)
'onlybusyevents': true, // Only copy events marked 'busy'
'busyness': 1, // Should events be marked 'busy' by default (0: free, 1: busy, 2: match source event)
'visibility': 2, // Should the events be visible by default (0: private, 1: public, 2: match source event)