This post explains how to retrieve google calendar meetings via a python script. Being able to connect to your own google calendar or to other’s calendars (through shared calendars within an organization) can be very powerful. As an example, you can grab all your team’s calendars, and mash the data up with a CRM system like Salesforce to better track and prioritize meetings.
Step 1: Download And Install Python X64 On Your Machine.
- Install Python (Python 3.4.0). Download Here
- Keep all the defaults for the installation (installed in C:/Python34)
Step 2 (optional): Download And Install an IDE for Testing/Coding Python
- This step is optional as you can run python from command prompt. You can also write the code in a notepad or notepad++.
- Install the attached LiClipse IDE. Download Here
- Keep all the defaults for the installation
- Open the software and Create a new PyDev Project
5. Configure the python interpreter in the IDE
6. Click Manual Config
7. Choose New
8. Enter the Interpreter name + Executable part of the python installation
9. Choose Ok, Ok, Apply, Apply and Close.
10. Enter a good name for the python project and finish creating the project.
Step 3: Turn on the Google Calendar API
- Use this link as a quickstart guide to configure the API https://developers.google.com/calendar/quickstart/python
- Follow the steps under Step 1 on that page, you will have to authenticate with google to proceed.
3. Download the client_id.json file, rename it to client_secret.json, and place in your python project.
Step 4: Pip install the Google Client Library
- Open a command prompt and navigate to the python34 Scripts folder
2. Pip install the google client library:
pip install --upgrade google-api-python-client
Step 5: Download the GoogleCalendarExport.py File and Run the program
- Download the GoogleCalendarExport.py file and place it in the project folder. Download Here
- Run the python script (you will need internet access on the server for this API call)
- Allow the program to access your calendar (this is a 1 time setup)
4. Once you complete authentication, the program should finish running, and you will see the GoogleCalendarExport.csv file populated in the project folder.
5. Re-run the script and ensure everything is working
**Google Calendar API has a limitation of 2500 events per request, so creating a custom pagination might be required to grab all events if you require more than 2500 events for a single calendar.
6. This script should be a good starting point for what you are trying to do. For more information on the API call itself, please checkout the google calendar API documentation:
Please sign in to leave a comment.