Google Apps Script Project with Google Calendar
Objective
Extract events on your calendar to make a list on a spreadsheet.
Difficulty: Easy
This is NOT coding from scratch. This is a getting started with Google Apps Script project. The template has the code.
Template
Steps
- Make a copy of the template by going to alicekeeler.com/calscript and making a copy when prompted.
- Use the Tools menu and choose “Script editor.”
- Don’t freak out. This is some Google Apps Script code (based on JavaScript). For this coding project, you are only going to EDIT the code, not write code. So an easy place to start. Take a look and see if you can make any sense out of it. Look for patterns.
- In JavaScript you can insert comments into the code (in other words, not code) by typing two slashes. //
I have inserted some comments (think post it notes) into the code to help explain what the code is doing.
Read the comments (they are in yellow). - First thing you need is the calendar ID from the Google Calendar that you want to extract a list of the calendar events from. This is the trickiest part of this project. Go to calendar.google.com and locate your list of calendars on the left hand side. Notice if you hover over a calendar that there is a tiny triangle. Click on that and choose “Calendar settings.”
- Locate the “Calendar Address.” If this is your default calendar it is just your email, so easy! If it is an additional calendar it is funky looking (classroom116209001132756006011@group.calendar.google.com.) Copy this.
- Back in the code! You will want to delete the words PUT CALENDAR ID HERE FROM CALENDAR SETTINGS
But leave the single quotes! Those are important. - Paste the Calendar ID in place of the text. Make sure there are single quotes around it.
- Change the dates. Look at your calendar, put some events on the calendar or look for a date range that has some events. This project is not that cool if you do not have any events to extract 🙂
Look at line 9 in the code and change the start date. Notice the pattern for how the dates are written.
Also, notice that the dates are in between single quotations. - Do not change any more code. Look at the rest of the code, but do not touch it.
- Save the code. Press the disk icon in the toolbar. (For those of you under the age of 20, it’s a square with a circle on it.)
- Run the code by pressing the sideways triangle icon in the toolbar.
- Toggle back to the spreadsheet. The code should insert a sheet and provide you your calendar details.