Delete Google Calendar events by date using Google Script

To quickly and easily delete Google Calendar events by date you can use Google Script https://script.google.com to run the following script.

Modify script to include your Google Calendar name which is likely your Google email. Then modify the date variables fromDate and toDate. Note the months start from 0 (Jan).

    function delete_events()
	{
		var calendarName = 'you@gmail.com';
		// for month 0 = Jan, 1 = Feb etc
		// below delete from Jan 1 2015 to Jan 1 2019
		var fromDate = new Date(2015,0,1,0,0,0); 
		var toDate = new Date(2019,0,1,0,0,0);
		var calendar = CalendarApp.getCalendarsByName(calendarName)[0];
		var events = calendar.getEvents(fromDate, toDate);
		for(var i=0; i<events.length;i++){
			var ev = events[i];
			// show event name in log
			Logger.log(ev.getTitle()); 
			ev.deleteEvent();
		 }
    }

This will delete your calendar events so be careful!

Check out Google Script documentation for more on how to work with Calendar.

https://developers.google.com/apps-script/advanced/calendar

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Post Navigation