Search a date range in Google Calendar and match any events with a given string, then delete those 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:
- Start date – format mm/dd/yyyy – forms the date range to look for events within.
- End date – format mm/dd/yyyy – forms the date range to look for events within.
- 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’.
- 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
I use Google Apps Script to support staff and students in my job. I enjoy dabbling with creating tools to help with automation and I freely share my learning experiences on my blog, where I also have a number of useful Google Add-ons: www.pbainbridge.co.uk
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
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