Skip to content

Instantly share code, notes, and snippets.

@larsbergstrom
Created January 24, 2020 13:32
Show Gist options
  • Save larsbergstrom/04095ab064f7f171da429899fb8431df to your computer and use it in GitHub Desktop.
Save larsbergstrom/04095ab064f7f171da429899fb8431df to your computer and use it in GitHub Desktop.
Delete a week in gcal
function cleanup()
{
var fromDate = new Date(2017,11,12,0,0,0);
var toDate = new Date(2017,11,16,0,0,0);
var calendarName = 'Mozilla';
var calendar = CalendarApp.getCalendarsByName(calendarName)[0];
var events = calendar.getEvents(fromDate, toDate);
for(var i=0; i<events.length;i++){
var ev = events[i];
if (ev.getGuestList().length == 0) {
Logger.log(ev.getTitle()); // show event name in log
ev.deleteEvent();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment