Here’s a not so hypothetical scenario…
You have downloaded a CSV file of player salaries from DraftKings or FanDuel. You pull that information into Excel. Your goal is to take the “Opponent” information and use it to determine who each player’s opposing starting pitcher will be.
You have also followed this very brief set of instructions on how to get a list of starting pitchers into Excel that refreshes automatically each day (OK, not so brief).
The challenge is that the list of starters does not use the same team name system as the DFS salary information. This is but one example of this. If you ever try to combine information about MLB teams that comes from different web sites, you’ll likely find a number of other inconsistencies. Even the sites that use abbreviations (like the DFS info above), don’t use them consistently. Sometimes the Giants are “SF” and sometimes they’re “SFG”. The Nationals might be “WAS”, “WSN”, or “WSH”!
The Solution – a Team ID Map
To solve this problem, I have created an “MLB Team ID Map”. It’s similar in concept to the Player ID Map.
The map lays out the abbreviations (or team name, in Fangraphs’ case) from the following sites:
- Fangraphs
- Baseball Reference
- FanDuel
- DraftKings
- Yahoo!
- ESPN
- FantasyPros
- BaseballPress
- Baseball Prospectus
- Rotowire
Two Formats to Use the Team ID Map
The information is available in both a web page format (so you can web query it) and in an online CSV file (see instructions on how to use the CSV option later in this post).
Link to the Web Page Format:
https://www.smartfantasybaseball.com/TEAMMAPWEBPAGE
Link to the CSV File:
https://www.smartfantasybaseball.com/TEAMMAPLINK
Importing the CSV Team ID Map Into Excel
Step | Description |
---|---|
1. | Open the fantasy baseball spreadsheet you’re trying to add the Team ID Map too.
In your Excel file, click the button toward the bottom to insert a new sheet. Then right-click on the new sheet and choose the menu option to rename it. Name it something like “MLB Team ID Map”. Now copy this bolded web address: That’s the address of the CSV version of the Team ID Map. |
2. | Click on the “Data” tab of the Excel ribbon and then click the “From Text” button on the “Get External Data” grouping of icons.
You will then be presented with a browsing window where you are expected to look for some kind of text file on your computer. Instead, just paste the web address you just copied earlier into the “File name:” field and then hit “Open”. |
3. | Excel’s “Text Import Wizard” will appear. Make sure the “Delimited” option selected (a CSV file is a data file in which the columns of data are separated by commas, this makes it “delimited”). Also make sure you have checked the “My data has headers” check box.
Hit the “Next” button to proceed to the next importing step. |
4. | This screen of the import wizard is asking what character type the delimiter is.
Because we are importing a CSV, it’s a comma (CSV stands for “comma separated values”). Check that option in the list of delimiters and look at the “Data Preview” to make sure the columns are breaking in the proper places (you should see lines drawn between each column). Click “Next” to proceed to the next step. The ensuing screen allows you to classify each column as a certain data type. The Team ID Map is simply a list of text information, so we don’t need to worry about changing data types here. Just click the “Finish” button. |
5. | You should then be asked where to import the data. This is an important screen here. I want to import this as an Excel table, but that option is currently grayed out.
Check the “Add this data to the Data Model” check box. This should activate the “Table” radio button. Before hitting “OK”, click the “Properties” button. This should bring up the “Connection Properties” menu. You might want to rename the connection to be something like “Team ID Map”. And then adjust the property check boxes to those shown below. Make sure to uncheck the “Prompt for file name on refresh” box. And although it sounds like a good idea to check the “Refresh data when opening the file” box, DON’T! Checking that now seems to cause error messages when opening my spreadsheets. But we can come back later and check it with no issue. Click “OK” to close the Connection Properties. Then click “OK” to accept the “Import Data” settings and to perform the actual import. |
6. | Now we can return to update the refresh file on opening setting. Click on the “Data” tab of the ribbon. Then click the “Connections” button. Locate the connection we just created. Select it from the list. Then click the “Properties…” button. Now check the “Refresh data when opening the file” box and click the “OK” button. |
7. | You now have the Team ID Map in your spreadsheet and it will update automatically any time I make adjustments in the future (if I add a new site’s team abbreviations, they’ll show up in your file). |
Give Me An Example of How to Use This Thing
You’ll need to use Excel’s INDEX and MATCH functions to make the best use of the Team ID Map (here’s an example of INDEX and MATCH).
Sticking with the same example from earlier in this post, you can use INDEX and MATCH to take the “Opponent” column in the image above, go into the Team ID Map, and bring back the Fangraphs standard team name.
Then in the “OpposingSP” column in the image above, take the value in your “FangraphsOpp” column, go into the probable starting pitchers list, and bring back the name of the starter for that team.
Download a completed Excel file example of this Google Sheet CSV Link w Team ID Map.
Need Another Site Added?
Let me know in the comments below if you’d like team abbreviations added from another site.
Thanks for reading. Stay smart.