CS 1 (Fall 2024) Project 04: Google Sheets Instructions

For the Newton’s cradle project, we use the Google Sheets API to interact with the information in a spreadsheet - this includes getting information about each pendulum and also updating various physical attributes of the pendula. Here are the instructions to set up the Google Sheets API. Here is a video of us setting it up:

And below are the written instructions that the video goes off of. If you have any issues with the setup, feel free to drop into OH!

Set up the spreadsheet

Go to this spreadsheet and click on “File” > “Make a copy” to create a copy. You may name it whatever you want. In the copy you just made, click on “Share” and change the settings so anyone with the link can edit the sheet. (Your Caltech Google account will not allow you to share to anyone with the link.)

Make a note of your spreadsheet’s unique ID - this can be found in the url of the Google Sheet:

https://docs.google.com/spreadsheets/d/SPREADSHEET_ID/edit?gid=0#gid=0

For example:

Create a project

Go to the Resource Manager on Google Cloud.. If it’s your first time signing in to the console, agree to the Terms of Service. Again, do not use your Caltech Google account.

Use the “Create Project” button to make a project with the project name CS1-project4 and “No organization” as the Location.

I can’t click “No organization” or there’s a third empty field.

Make sure you used a personal Google account ending in @gmail.com. Come to OH if something still is not working.

Turn on the APIs for the service account

Go to the Google Sheets API and click “Enable”.

Create the service account

Create a service account at this page and complete the following steps.

You’ll get a message that the service account’s private key JSON file was downloaded to your computer.