How to Bulk Delete Google Calendar Events Using Apps Script

The Problem with Rogue Calendar Events

If you have ever imported a massive CSV file into Google Calendar or synced a rogue third-party application, you know the pain of hundreds of duplicate or unwanted events flooding your schedule. Because Google Calendar does not have a native “select all” button or a mass-delete function, you are normally forced to click and delete every single event one by one.

Fortunately, Google Workspace provides a powerful backend scripting tool called Google Apps Script. By writing a few lines of JavaScript, you can automatically loop through a specific date range and permanently purge all events in seconds.

Step 1: Open Google Apps Script

Google Apps Script runs completely in the cloud, meaning you don’t need to install any software on your computer.

  1. Open your web browser and navigate to script.google.com.
  2. Click the New project button in the top left corner.
  3. Rename the project at the top to something recognizable, like “Bulk Delete Calendar Events”.

Step 2: Write the Deletion Script

Delete the default myFunction() placeholder text in the code editor, and paste the following script. This script connects to your primary calendar, defines a specific date range, and permanently deletes every event found within that window.

function deleteCalendarEvents() {
  // 1. Connect to your primary Google Calendar
  var calendar = CalendarApp.getDefaultCalendar();
  
  // 2. Define the exact date range to purge (Format: YYYY, MM-1, DD)
  // Note: JavaScript months are 0-indexed (January is 0, December is 11)
  var startDate = new Date(2025, 0, 1); // January 1, 2025
  var endDate = new Date(2025, 11, 31); // December 31, 2025
  
  // 3. Retrieve all events in that time frame
  var events = calendar.getEvents(startDate, endDate);
  
  // 4. Loop through and delete them
  for (var i = 0; i < events.length; i++) {
    events[i].deleteEvent();
  }
  
  Logger.log("Successfully deleted " + events.length + " events.");
}

Crucial Warning: Be extremely careful when setting your startDate and endDate. Once this script runs, the events are permanently deleted and cannot be recovered from a trash bin.

Step 3: Authorize and Run the Script

Once you have customized the dates in the code, you are ready to execute it.

  1. Click the Save button (floppy disk icon) in the toolbar.
  2. Click the Run button at the top of the editor.
  3. A popup will appear stating “Authorization required.” Click Review permissions.
  4. Select your Google Account. Because you wrote this script yourself, Google will show a warning saying “Google hasn’t verified this app.” Click Advanced, and then click Go to Bulk Delete Calendar Events (unsafe).
  5. Click Allow to grant the script permission to modify your calendar.

The script will immediately begin executing. Depending on how many hundreds of events you have, it may take 10 to 30 seconds to run. Once finished, check the Execution Log at the bottom of the screen to see exactly how many events were purged, and then verify your clean Google Calendar!

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.