Note: The script will show you the results, and then ask you to proceed with deletion. It does NOT delete without permission first.
- Create a project on GCP if you don't have one already
- You will likely need to enable the Calendar API for that project
- Create an "Desktop App" OAtuh credential on GCP
- Click the JSON export button
Google-Calendar-Cleanup/gcalcleanup.py
Line 22 in e2b4e49
Google-Calendar-Cleanup/gcalcleanup.py
Line 55 in e2b4e49
Google-Calendar-Cleanup/gcalcleanup.py
Line 57 in e2b4e49
Google-Calendar-Cleanup/gcalcleanup.py
Line 60 in e2b4e49
- Run the following
python gcalcleanup.py
- The script will auto-generate a token.json file. If you are iterating with this script, sometimes you need to delete it as it stores scoping/permissions stuff and can hinder expected outcomes with code changes.
A successful run looks like this:
If you have python errors, make sure you have python3 installed. If PATH isnt set, you can also try running:
python3 gcalcleanup.py
- Concurrent API calls
The script currently churns out about 1 call per second, or 60 per minute, due to its sequential nature. For smaler loads this may not be an issue, but some folks like myself may be dealing with thousands of events. The Google API quota is about 240 per minute limit, which means this could see a 3x or 4x increase in throughput with concurrent calls.