100 Scripts in 30 Days challenge: Script 4 — Getting Event details from Google Calendar using Python

I have always wanted to get the details of my Google Calendar to be a power user so that I am always up to date on my schedule as I conduct meetups and other events and also to check if I am missing anything.

Much of the content of the script is inspired from the below link:

The only changes being that I have added steps to add the data to a sqlite database for future use and get a complete extract into csv format.

Step 1: Turn on the Google Calendar API

  1. Use console wizard to create or select a project in the Google Developers Console and automatically turn on the API. Click Continue, then Go to credentials.
  2. On the Add credentials to your project page, click the Cancel button.
  3. At the top of the page, select the OAuth consent screen tab. Select an Email address, enter a Product name if not already set, and click the Save button.
  4. Select the Credentials tab, click the Create credentials button and select OAuth client ID.
  5. Select the application type Other, enter the name “Google Calendar API Quickstart”, and click the Create button.
  6. Click OK to dismiss the resulting dialog.
  7. Click the file_download (Download JSON) button to the right of the client ID.
  8. Move this file to your working directory and rename it client_secret.json.

Step 2: Install the Google Client Library & Other dependencies

pip install — upgrade google-api-python-client
pip install appdirs

And other dependencies as present in the script.

  • Create conf_sample.toml under conf directory.
  • Run the code as “python google_calendar_details.py”

Code for the Script:

For any further details you can contact me on twitter https://twitter.com/twitmyreview or https://www.linkedin.com/in/priyabrata-dash-21616b15/.

All feedback and suggestions are welcome.

Like what you read? Give Priyab Satoshi a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.