'Bulk delete Google Calendar events

i would like to delete calendar events that has a specialword in the event name "Stockholm".

I got this, but it's only by date. Could it be done by keyword?

var fromDate = new Date(2013,0,1,0,0,0);
var toDate = new Date(2013,0,4,0,0,0);
var calendarName = 'My Calendar';

// delete from Jan 1 to end of Jan 4, 2013

var calendar = CalendarApp.getCalendarsByName(calendarName)[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();
}


Solution 1:[1]

calendar.getEvents() accepts a search option. You just need to modify that one line:

var events = calendar.getEvents(fromDate, toDate, {search: 'Stockholm'});

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dave A-W