create_google_calendar_entry.sh is a bash script to manipulate a calendar hosted in Google. It isn't full polished. Basically, you just modify the script's main function to make the script do what you need. So when the instructions below say to run something, they mean to modify create_google_calendar_entry.sh's main function, save, and execute the script.
- Mac M2
- Bash 5.x installed from brew.
You need to set several variables in the config file. To get the values, you need to monkey with Google.
- Set up a Google Cloud project.
- I did this awhile ago and forgot how. Maybe the references will help.
- Start by going to [https://cloud.google.com].
- Hamburger -> APIs & Services -> Credentials
- With the project setup, create an OAuth 2.0 Client ID in the project.
- For the Authorized Redirect URL, you can put
https://developers.google.com/oauthplayground
. - Drill into the details for the Client ID. It will probably end in something like
ppuc.apps.googleusercontent.com
. - Set that value in the file
my.config
in this repo.
- Get your Google calendar_id. See https://www.sociablekit.com/get-find-google-calendar-id/ or google how. It will probably end with '@group.calendar.google.com'
- Set that value in the file
my.config
as calendar_id in this repo.
- Open a web browser and log in to the gmail account with the calendar you want.
- run get_authorization_token
- It should open a page in your browswer.
- Find the response on that page and strip out the authorization token. It will 165 some odd characters long.
- Paste that as the value for my_token in
my.config
. - Run list_calendars to verify the creds work
- Set it to whatever you want. For a list of valid values...I don't know. Search the web? Sorry that there are two versions.
- Set it in
my.config
.
Update the script to specify all the entries you want to add 'add_new_entries'.
For example, if you want to add an all day calendar entry on November 27, 2021 that says 'Hello World', then:
add_new_entries(){
add_all_day_entry '2021-11-27' 'Hello World'
}
If you want to add the same entry, but from 8pm to 9pm:
add_new_entries(){
add_timed_entry '2021-11-27' '20' '21' 'Hello World'
}
see: