This is a simple Google Apps Script which lets you modify Google Calendar events in bulk.
These instructions assume that you have basic knowledge of JavaScript. Documentation of the Google Calendar API here.
- Create a new Google Apps Script project
- Find the "Services" section on the left sidebar. Click the "+" button and add Google Calendar API (v3)
- Copy the contents of
Code.gs
intoCode.gs
in your project - Customize the script as explained below and run it!
- On the first run you'll be asked to log in with your Google account to connect to the Calendar API. Don't worry about the warning you'll see, this is normal.
In order to customize the function, change the following constants and functions in the top section of Code.gs
:
Test
- enables test mode. If enabled,TestFn
will run instead ofModifyFn
. This is to let you test your modifications on one event instead of applying them on all events at once.TestFn
- the function used in test mode. It runs once with the (filtered) list of events as its parameter. In this example if applies the modifications (described inModifyFn
) to the first event on the list and logs the event before and after the changes.CalendarId
- the ID of the calendar you want to modify. Find it by going to Google Calendar settings for this calendar and scrolling down until you find "Calendar ID". You can also pass "default" to use your account's default calendar.FilterFn
- filtering function which lets you select the events that you want to modify.ModifyFn
- the function that applies your modifications on every event (when test mode is disabled). In this example it changes the event's time to 11:40-12:10.
By default the modifications are only applied to events in the future. Feel free to change that by customizing the timeMin
and timeMax
fields in the events query (lines 37-41).