Skip to content

Data Storage via Google Sheets

JacobBueno7 edited this page Oct 21, 2023 · 2 revisions

Data Storage via Sheets

In this documentation, you will learn all you need to know about how sheets works together with the Shepherd repo to retrieve and update information.

How to install the library to use sheets

Copy and paste the following command into any terminal or git bash to install the required libraries:

pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib

How does sheet.py work?

sheet.py contains a class with many different methods that we use to either pull information from the sheet or update information in the sheet. There are some main methods in the sheet.py file that allow Shepherd to do the things mentioned above:

  • get_match(match_number) - this method allows us to retrieve the match information given a match code
  • __read_online_scores(match_number) - this method allows for Shepherd to retrieve the score of a given match
  • __get_authorized_sheet() - this method gets the user credentials from the sheet and returns a spreadsheet service thingy which allows us to modify the spreadsheet
  • __write_online_scores(match_number, blue_score, gold_score) - this method allows Shepherd to update the information in the sheet to reflect a score that was just gotten by a team
  • __write_scores_from_read_scores(match_number) - this method allows us to swap scores between tabs in a sheet
  • __write_match_info(match_number, teams) - this method writes the match info into the sheet
  • __write_alliance_selections(alliances: list) - this method writes the alliance selections for the teams into the sheet
  • __write_whack_a_mole_scores(match_number, alliance, score) - this method writes the whack-a-mole scores of a certain team/alliance into the sheet