How to put data from the tba api into google sheets

I would like help to get the data from the TBA and transfer it to google sheets.
How would the code be assembled?
I found some helpful posts here on CD, but they are very old and have problems.

Depending on how complex the requests you are looking to make, here is a nice solution which should still work: Scouting Data made easy - Connecting TBA to Google Sheets - #15 by thertenstein

If you are looking at doing anything more complicated than that, you will probably need to start working in app scripts: Is it possible to send HTTP request from inside Google docs? - Stack Overflow

1 Like

A few years back I used TBA Requests It worked very well for my use case.

2 Likes

First, you need to log in to your TBA account. Once you do this, you can get an API key that you can use to export the API as a JSON file that is updated.

Currently, Google Sheets does not have a simple command called importJSON, but you can easily find written code that you can copy to AppsScript, and after running it, an importJSON command will be added to Google Sheets. You can find a link to the code for this command here.

When we did this we wrote a significant portion of the code ourselves, so I’m less comfortable sharing it, but this GitHub repository certainly looks great. If it doesn’t work, you can easily find other programs.

  • Someone once uploaded a more detailed guide to connecting TBA to Google Sheets. Last year, when I tried to use it, part of it didn’t work for me, but the part about the API key I think is very helpful:

I will add that it is very useful, last year we transferred the information from our scouting system to the strategy system using JSONS and it worked great throughout all the competitions.

If you have any problems or questions about this I will be happy to help you:)

1 Like

The most efficient, and nicest-looking way to do it is using the Google Sheets app scripts feature. Where you can create a function to send an API request to TBA using their APIv3, you can then parse it and import it into a range of cells.
You can make a text box in your sheet and assign that to, on click, send the request and import the data received.

This assures you don’t send requests anytime someone reloads the Google sheet, as well as makes sure you don’t have any functions taking up cells on the sheet itself, instead it just automatically imports the data. This is also nice because you can choose to parse your data any which way for whatever you need.

I can share some of my own code on how I personally did this. APIv3 docs is a great resource for crafting requests and parsing data and google app scripts api docs is a good resource for learning how to use google app scripts.
here is an example of how to pull a simple schedule. https://script.google.com/d/1hOKvAliu1DIi1jXCzD9Gk2McFnT-OWZ7sPLJwX4Aw3Si949CgkCE5IrY/edit?usp=sharing

1 Like

I recently did a big pull of a bunch of historic data (only official play, no offseasons) from TBA going back to 2002 and up to 2024, using Python and their Rest API and dumped it in a SQL database for a side project.

But I am also able to generate CSVs (or JSON) which can be imported into Google Sheets if you let me know what you need.

Pay attention to if the older stuff you are digging up uses TBA api v2 or TBA api v3.

I’m still around, and I can help out if needed! Cool to see a 5 year old project pop up like this.

I don’t have access to those resources anymore, as I have moved and I’ve lost most of my old 3324 resources. However, I did find the scouting app we made for 2020 (linked here).. It used to work, but it’s been almost 5 years.

OP - Feel free to DM me with a link to your project and I can try to troubleshoot things if you’d like!

1 Like