Calendar Automation with Python using Google Calendar API and OAuth2 Authorization System
There’s no doubt to say when we forget a date, we look for a calendar. In the last two decades, technology has evolved very rapidly and the digital calendar is vogue to stay productive. You may or may not stay on time but your calendar is always on time to remind you about your next event. It made our lives much easier to stay productive, time punctual, and efficient.
Google Calendar is the most commonly used calendar app that we use with over 1 Billion+ downloads. It tells how much people love using this app. You probably know that you can automate your Google calendar according to you. If not, don’t worry! In this article, I am going to tell step-wise-step to automate your own Google Calendar. If the idea excites you, there is a gift at the bottom.
What is Calendar Automation?
In general use, automation can be said as performing tasks by giving commands. Though, it is not fully automated you have to keep few commands like describing an event. It makes human intervention minimal. All tasks will be performed by the program, the user needs to give instructions.
STEPS TO AUTOMATE YOUR GOOGLE CALENDAR
For making this, you need to know Python a little bit but don’t worry you do not know to program. Follow this article and by the end, you will be having an automated calendar created by YOU!
- First, we need to get credentials.json and for that follow below:
- You need to have an OAuth consent screen which is very easy to do:
Here create a new project name of your choice. Then go to the OAuth consent screen.
Here you have to choose the user type if you have a Google workspace account you have a choice to choose Internal. But for general choose external.
Choose the scope shown in the picture and continue, and then set your google account as a test user. Remember when you run the program, you must log in with your test email.
- Now since you made an OAuth screen, get your API credentials.
Here you have to select OAuth client ID since we want to log in to our account to make it automated.
Keep application type as a desktop app and give your app any client app.
Now we are good to go to start programming our calendar automation app. Seems easy and fun right?
2. Now, we’ll start programming it
I suggest you use Pycharm because it makes it easy to set up the environment and install libraries. Create a folder name it according to you.
We will name our program files cal_setup.py and main.py. Also, move your credentials file into the folder you created and rename it. Here token.pickle file gets created automatically when we authorize the login, it gets stored to perform tasks without logging in over and over again. Open the folder in pycharm and create .py files named cal_setup.py and main.py. Let's code in three easy steps.
First, we need to install packages:
Copy and paste the above command in your Pycharm terminal.
Copy the following code and paste it in cal_setup.py
Do not forget to move your credentials.json file. Otherwise, you have to give the path to the credential file.
Now, we made it to our third step. Copy the following and paste it in your main.py
Now, I hope you are reading this article. You can change the program if know Python. Remember do not to change anything in cal_setup.py. Though you can change time, hour, description &, etc. As I said there’s something special for you!
Below is the project repo, you can download it and run it if you do not want to program on your own. You still need to install the package.
Contribute to Aakash-Roy/cal-auto-google-calendar development by creating an account on GitHub.
This is licensed under MIT, please review the license before using, modifying, or replicating it.