AppsScriptPulse

Delete Google Calendar Events by keyword and date range

Search a date range in Google Calendar and match any events with a given string, then delete those events.

Search for and delete Google Calendar events

Search for and delete Google Calendar events

The following Google Apps Script is designed to search a date range for Google Calendar events containing a given string (something to help target those events) and then delete them.

There are 4 items at the beginning of the script to complete for your requirements:

  1. Start date – format mm/dd/yyyy – forms the date range to look for events within.
  2. End date – format mm/dd/yyyy – forms the date range to look for events within.
  3. Search string – bit of text that is unique to the events you wish to delete to differentiate them from other Calendar events you may not wish to remove. Note: is not case-sensitive and will not pick-up search string inside of another word eg ‘the’ in ‘there’.
  4. Calendar ID – typically your email address for your personal Google Calendar to search for events in.

Source: The Gift of Script: Delete Google Calendar Events by keyword and date range

2 comments for “Delete Google Calendar Events by keyword and date range

  1. Andrew Dixon
    26 May, 2023 at 00:1121

    Hi .. just found your delete Calendar Event script….looks good and fixes a issue with my version.

    A little help please … to run it as a shortcut from a browser, what do I need to change ? I tried just changing the function to DoGet , but I get a cant find DoGet message…

    I am slowly building series of scripts t populate AllDay events from a xlsx sheet…your script looks like it will be part of the final version

    Many thanks

  2. Phil Bainbridge
    29 May, 2023 at 15:3521

    Hi Andrew

    Just to confirm you contacted me directly about this and have now got a working solution via a doGet Function.

    Kind regards
    Phil

Leave a Reply

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