Google Sheets API Integration

Sort:
cartercausality

I created a chess club at my high school. To ensure fairness in matches, I created a spreadsheet (Google Sheets) with all members' names and a column for Rapid ratings. However, it is obvious that manually editing this would be tedious. I know that the API can fetch Stats data, but I am new to working with this. If anyone is able to help, it would be much appreciated. Thank you.

WhiteDrake

The API doesn't fetch anything. happy.png It's an interface, which enables you to fetch the data. You're interested in this endpoint: https://api.chess.com/pub/player/terabytecarter/stats. I've used your name, the name would be different for every player. It contains data in the JSON format (I suggest you open the link in Firefox, which displays JSON nicely).

If you want to automate the process you've described, you need to write a little bit of code: for each player, make a GET request for the URL (based on their name) and extract the rapid rating from the fetched JSON data. Then write the ratings of the players into a file. It'll likely be quickest if you copy & paste the data to the G sheet by hand then.

Edit: Do you have experience with any programming/scripting language?

bcurtis

https://www.google.com/search?&q=sheets%20value%20from%20JSON%20api

You can create a column with usernames, and then use any of the tutorials and scripts in the above search result to:

  1. use that username to create a URL
  2. call the URL and retrieve the JSON
  3. parse the JSON to get the stats value you want

In theory, you would just need to code this once and it would populate the current data each time you open the sheet.

cartercausality

@WhiteDrake sorry for the extremely late response but I'm new to scripting and coding as well. 

WhiteDrake

Well, as somebody who has some experience with coding, I believe that if you’re new to scripting and coding, you won’t safe time (rather the contrary) by automating the process via the Chess.com API. I like coding and I think scripting a bit would be more fun than filling in Google sheets manually, but expect it’d take some of your time.

That said, if you want to invest some of your time into this, I’m pretty sure you’d find people here (and all over the Internet, for that matter happy.png) willing to help you with concrete issues. Like if you have trouble installing the IDE, parsing JSON, etc. It just depends on your priorities, I guess. happy.png