2

Is there a way I can do something to delete like 1000 events or more with the same name at the same time? They are actually not recurrent but they were originally recurrent from Outlook but not anymore. Is there any other way to delete them all at once please, than just manually?

2

1 Answer 1

4

You'll open Google Drive and make a new script. Delete everything. Paste the code below into the script editor. Make your changes to the date range and title element.

When you have it setup, hit the play button. You'll need to give it permissions when the window pops up. That should do it.

function myFunction() {

  var fromDate = new Date(2016,0,1,0,0,0); //start date range
  var toDate = new Date(2016,8,11,0,0,0); //end date range
  var calendarName = 'fake'; //name of your calendar

  var calendar = CalendarApp.getCalendarsByName(calendarName)[0];
  var calId = calendar.getId();

  var events = calendar.getEvents(fromDate, toDate);

  for(var i=0; i<events.length;i++){
    var ev = events[i];
    var title = events[i].getTitle();

    //set fish to whatever title you want to delete
    if (title === 'fish') {      
       var kill = title;
       ev.deleteEvent();
    }  
  }
}

Not the answer you're looking for? Browse other questions tagged or ask your own question.