Skip to content

Instantly share code, notes, and snippets.

@beefy
Created August 28, 2017 18:26
Show Gist options
  • Save beefy/55ef6bc0e0d76b4bbae365e3ae4b18c2 to your computer and use it in GitHub Desktop.
Save beefy/55ef6bc0e0d76b4bbae365e3ae4b18c2 to your computer and use it in GitHub Desktop.
Delete all google calendar events in a range
function myFunction() {
var fromDate = new Date(2017,8,1,0,0,0);
var toDate = new Date(2017,8,16,0,0,0);
// delete from Sept 1 through Sept 15, 2017
var calendar = CalendarApp.getCalendarsByName('NateSchultz')[0];
var events = calendar.getEvents(fromDate, toDate);
for(var i=0; i<events.length;i++){
var ev = events[i];
Logger.log(ev.getTitle()); // show event name in log
ev.deleteEvent();
}
}
@beefy
Copy link
Author

beefy commented Aug 28, 2017

Run online at https://script.google.com/macros/
Rename calendar name to match.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment