How to bulk delete Google Calendar events via Google Apps Script

Google Calendar is one of the most popular calendaring platforms for enterprises and every day users on the Gmail platform. Despite its popularity, Google has been woefully slow in releasing simple features such as bulk deleting events off your Google Calendar.

Take for example, in this scenario, I have 20 instances of meeting “Event 1” on my calendar. I’d like to get rid of the ones between June 1st – June 30 2020.

How do I delete them all?

The only way to do this via the Google Calendar interface is to select each event and click the delete button. Not so efficient now is it!

Google Apps Script ( is a lightweight scripting tool based on JavaScript that allows interaction with Google Apps data including Mail, Calendar, Sheets, etc.

It can be super helpful in situations like these where the usual UI elements do not allow for automation of these repetitive tasks. Let’s setup a Google Apps Script to delete events called “Event 1” that are on my calendar from June 1st – June 30th 2020. You’ll need to adjust these parameters to fit your situation.

To get started, browse to, log in with your Google account, then click on New project

Google Apps Script

Click on “Untitled Project” and give the project a name. For our example I’m going to call it “Bulk delete GCal events”. This can really be anything you’d like it to be.

Copy and paste the following code block into the Google Apps Script editor

function delete_events()
  //Please note: Months are represented from 0-11 (January=0, February=1). Ensure dates are correct below before running the script.
  var fromDate = new Date(2020,5,1,0,0,0); //This represents June 1st 2020
  var toDate = new Date(2020,5,30,0,0,0); //This represents June 30th 2020
  var calendarID = ''; //Enter your calendar ID here

  var calendar = CalendarApp.getCalendarById(calendarID);
  //Search for events between fromdate and todate with given search criteria
  var events = calendar.getEvents(fromDate, toDate,{search: 'Event 1'});
  for(var i=0; i<events.length;i++) //loop through all events
    var ev = events[i];
    Logger.log('Event: '+ev.getTitle()+' found on '+ev.getStartTime()); // Log event name and title
      ev.deleteEvent(); // delete event


Click on the Save button to save the pasted code into the project.

Next lets, modify the fromDate, toDate, calendarID variables to ensure you are searching the right calendar and in the appropriate time-frame.

Dates in Google Apps Script are 0 indexed which means January is actually month 0 (eg. var fromDate = new Date(2020, 6, 1, 0, 0, 0) represents July 1st 2020).

To find your calendar ID, go into your Calendar Settings in Google Calendar, scroll down to Integrate Calendar and find your CalendarID. For most Gmail users, your primary calendar will be your email address. Use this calendarID in line 6 of the script.

Find your calendar ID by going into Calendar Settings in Google Calendar and scroll down to “Integrate Calendar”

Next let’s modify the search criteria to narrow down the events you want to delete. Line 11 of the script specifies the title of the event the script will search for. All events matching that title and the from and to date ranges will be in our scope of deletion.

Once you are satisfied you’ve modified all the parameters, click on the play button to run the script. The first time you run this script, you will see a Google Authorization screen. The script does does not have access to your Google Calendar. You will have to approve access before the script can do its magic.

Click Review Permissions to authorize the script to access your Google Calendar data

Now since you aren’t a Google certified developer you will see this gigantic scary warning screen. Please note that this is Google’s attempt to ensure rogue apps do not get access to your Google data. As always you should be careful before allowing random apps access to your Google Data.

Click on Advanced and then click on “Go to Bulk delete GCal Events (unsafe)

To ensure safety of your Google data, never approve access for apps you do not recognize.

On the next screen you should be able to see what data this script will be able to access. As we see, this script is asking for access to edit your Google Calendar. Click on Allow to let the script run on your calendar.

The script should start running as soon as you authorize access. If it doesn’t run, click on the Play button again. This time it shouldn’t prompt you for authorization.

Once the script stops running, let’s go back on our Google Calendar to confirm the events are now gone. Voila!

The script run took 2-3 seconds while many minutes I would have spent deleting 20 some events. Think how much time you’d saved if you had thousands to delete!

Rishi Dhar

Rishi Dhar

Creative techie by day; wannabe astronaut by night; world traveler in my free time; a true desi during teatime.

You may also like...

4 Responses

  1. Avatar jim says:

    hello thanks, for your tutorial, i want to upgrade your scripts to deleting several events from several Calendar .
    But i don’t , write correctly my script.
    you can help me ?

  2. Avatar Nicole says:

    Greetings Rishi, I have been trying to bulk delete events, not by name, but just ALL events from one date to another. The script runs. It says: Execution started and Execution completed, but all the events remain in tact. Please could I ask for help?

Leave a Reply

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