Blog

How to upload data into Sports Bench

MacBook showing a screenshot of the import data page for Sports Bench in the WordPress admin while sitting on a wooden desk

Creating a sports league website with Sports Bench is simple when you’re just starting out. All you have to do is just add in all of the teams, players and games right in the dashboard area.

But what if your league has been around for a while and you have stats and information saved in an Excel spreadsheet? Or what if you want a quicker way to get all of the data into your website instead of doing it by hand?

Sports Bench allows you to import CSV files that can add in data for each of the Sports Bench tables — divisions, teams, players, games, game events, game player stats, playoff brackets and playoff series.

This tutorial will go through how you can upload those CSV files so you can get your data into Sports Bench and your website in just a few minutes. The good news is that it is pretty easy once you get going, but there are a few things you’ll need to watch out for along the way.

Upload all images into your WordPress media manager

If you’re uploading players and/or teams and you have photos or logos that need to be imported with them, you’ll want to upload them to the website first. From there, you can then copy the URLs for each file uploaded and put in the correct column for that player or team.

This will make life much easier for you since the value for those columns is simply the URL for the logo or photo. You won’t have to go through to each team and upload the logo one at a time.

It will save you time and headaches down the road.

Creating the CSV file

Once you have your images on the website, it’s time to create the CSV files for each table to import data from.

If you don’t know what that is, don’t worry. It’s as simple as creating an Excel file or a Google sheet and then saving it as a CSV file rather than an Excel file.

For the spreadsheet itself, you can put the column headers at the top (more on that in the next section), and then put the rows of data beneath those columns. It’s basically just a simple table with a couple of extra steps to turn it into a CSV file that can be uploaded to the website.

Add the column headers you will need

I also do want to note that your CSV file will need to have the correct column headers so that the data goes to the right column in the database.

The good news is that the column headers are listed on the “Import” tab in the Sports Bench options. Once you navigate to that section, you can click on a table to see what column headers are available for that table.

You can then place those headers in the first row of your CSV file that you’re creating.

Screenshot of the import data page for Sports Bench in the WordPress admin
Screenshot of the Import page for Sports Bench in the WordPress admin.

Uploading the CSV file into Sports Bench

Once you have your CSV files ready to go, you’ll need to import them into Sports Bench on your website. And the good news is that this step is actually pretty easy.

You’ll need to navigate to your dashboard and then hit “Sports Bench” in the menu on the left side. Then select the “Import” tab on the options page.

From this screen you can select what table you’re importing to the website.

Generally, I prefer to upload the teams table first. That way you can then grab the team ids that need to be used in the other tables.

After that, it’s probably best to add in the players so you can add in the player ids where needed in the remaining tables.

Next would be the games table so that you can add in the game_ids to where they are needed for the game_info and game_player_stats tables and the playoff tables (if you have them).

Once you have all of the tables imported, take a look at the imported data on the admin side of the website to make sure that it’s all correct.

If it is, you’re good to go and to start using Sports Bench for your league. If not, you might want to see what’s wrong and figure out if it might be user error or if you need to reach out for help.

Check out the documentation for more information

Want to learn more about the various tables for each part of Sports Bench? Or want to check out what you can customize with Sports Bench on your website? Then you’ll want to check out the documentation to learn more. You’ll find information for all of the various functions, hooks, classes and more.