google-calendar-helper
This is just a side project I did for adding events to my personal Google Calendar using the Google API. I was tired of adding multiple events all with the same configuration and having to go back and update all of them when manually I wanted to make changes.
Disclaimer: The library isn't necessarily comprehensive in covering all of Google Calendar's available APIs, does not have test cases, and may not be generic in all scenarios; this was primarily made for my own use cases.
Usage
- Follow only Step 1 of Google's Node.js Quickstart. This will result in a
credentials.json
file. - Run the following command anywhere in your terminal
npx google-calendar-generator --credentials ./PATH/TO/credentials.json --token ./PATH/TO/token.json --config ./PATH/TO/config.js
NOTE: The first time you run the program, you will not have a token.json
. For the --token
, just specify where you would like the token.json
to be auto-generated.
- Check out your new calendar at https://calendar.google.com/
See ex-calendar-config.js for an example calendar configuration
Calendar Configuration Documentation
module.exports = [
{
name: "Example Calendar #1",
colorId: 1,
recreateCalendar: false,
recreateEvents: false,
events: [
{
summary: "Event #1",
date: "2000-01-31",
recurrence: "YEARLY",
reminders: [
{ method: "email", weeksBefore: 4 },
{ method: "email", weeksBefore: 3 },
{ method: "popup", weeksBefore: 2 },
{ method: "popup", weeksBefore: 1 }
]
}
]
},
{
name: "Example Calendar #2",
colorId: 10,
recreateCalendar: true,
events: [
{
summary: "Event #1",
date: "2000-12-25",
recurrence: "YEARLY",
reminders: [
{ method: "email", minutesBefore: 4 },
{ method: "email", minutesBefore: 3 },
{ method: "popup", minutesBefore: 2 },
{ method: "popup", minutesBefore: 1 }
]
}
]
}
];
References