MLB

These files are automatically generated at 12:00 PM every day based on roster information at http://www.mlb.com. The ROS files are formatted in the Retrosheet roster format. The .CSV files are to be used with FixedIt baseball scoring software. query(“SELECT * FROM leagues WHERE classid = ‘MLB’ ORDER BY leaguename ASC”);
$this_year=date(‘Y’);
while($thisrow=$get_leagues->fetch_assoc()){
echo(“

$thisrow[leaguename]

“);
$get_teams=$dbcnx->query(“SELECT * FROM teams WHERE league=$thisrow[id]”);

while($row2=$get_teams->fetch_assoc()){
echo(“

“);
}

echo(“

Team Name ROS CSV (FixedIt) CSV (Ballstat)
$row2[teamname] ROS CSV CSV
All MLB Players (ROS Format)


“);
}
?>
Trackback

35 comments until now

  1. Richard Thomas

    Hello,

    Great site, love it!

    I’m interested in how you generate .ROS and .CSV files from http://www.mlb.com; i assume that you either scrape the info from each roster page or use XPath queries?

    I’ve written a similar program to do a similar thing, except i’m gathering from the roster files at http://hosted.stats.com/mlb/teams.asp. The advantage of those rosters over the ones at mlb.com is that there is more specific information about each players’ position.

    I don’t have my program running automatically at the moment, but it generates .CSV and .KSS (an xml format used by program KForCe [http://www.rakonza.com]). I used to generate .ROS as well, but gave up on FixedIt because of lack of support and updates.

    Again, thanks for your work!

  2. Hi Richard,

    I’m glad you like the site!

    The rosters are created by screen scraping the MLB/MiLB websites using PHP/Curl. It’s not the prettiest thing in the world, but it works.

    Thanks for the info on the Stats site. You’re right. They do a better job of listing LF,CF,RF vs. OF. I might consider switching to them for MLB info.

    What are your thoughts on KForCe?

    Ben

  3. Can’t get the Washington Nationals download .ros to work. Can you help?

    Darren

  4. works for me…

    http://www.pitchbypitch.com/rosters/files/WAS2009.ROS

    let me know if it’s not working.

  5. Hello, I use BallScore/BallStat and have been unable to find a site where I can download the rosters in a format usable by this program.

    Your site is the best I have found, and would like to thank you for providing this info!

    One thing I have noticed is that the ROS files don’t include the jersey number, and the CSV files combine the player’s name.

    BallScore can import either of these formats, but I end up having to manually add the missing pieces. For me the ROS files would work great if it included the jersey number. Is their any chance of adding this?

    Basically, BallScore uses a format as follows:

    Team Name
    Jersey#, First Name, Last Name, Bats, Throws
    Jersey#, First Name, Last Name, Bats, Throws
    etc, etc.

    The first line is not comma delimited.
    Then each following line is comma delimited.

    Just wanted to suggest this, as I know there are a lot of folks out there who use this program.

    Thanks again for the roster info. Great work!

  6. No problem. I generated the Ballstat .CSV files, and you can access them from the Roster Files pages.

    Let me know how they work.

    How do you like Ballstat? I’ve never used it.

  7. Robert B

    Tried Ballstat… It’s OK, but I’ve gotten so used to project scoresheet-style scoring that it’s hard to go back. Really waiting for the pitch-by-pitch portion of your sheet to really make it worthwhile.

    Now that I’ve seen how the bevent works, you can do so much analysis on these stats!

    Rob

  8. Harrison L

    I found an old scorecard from a couple of years ago and wanted to put it in the scoresheet on the computer. However, some of the players are free agents now and the current rosters won’t work for this. How can I figure out or create codes for older players.

  9. The most ideal way would be to download the season roster file for these two teams. You can get it from http://www.retrosheet.org/game.htm.

    Another way (if you’re just interested in just creating a scoresheet and box score and not analyzing this game with other games), is to manually type each player into the Home and Away tabs of the scoresheet. Put a random unique ID in column A, Last name in column B, first name in column C, and the player’s full name in Column H. Everything should process fine.

    Let me know how it works!
    Ben

  10. Robert B

    Just a curious question…

    If I find I need to add a player to a team’s ROS file (i.e. TOR2009.ROS to add Randy Ruiz), When I open the ROS file in notepad, I noticed there are no spaces or line breaks between records, but when I open it in Word, there are. Is that a special character between records?

    Thanks as always,
    Rob

  11. Richard Thomas

    Hello Ben,

    I haven’t visited your site for some time, but wow, what an improvement, looks great!

    I still have my program that reads http://hosted.stats.com/mlb/teams.asp and generates KSS (XML format used by KForCE [http://www.rakonza.com] and CSV formats. I gave up on generated ROS files long ago because i stopped using FixedIt because of their non-existent support (although i still can — i believe you gave me a utility to aid in doing so).

    Again, great job!

    Richard Thomas

  12. Richard Thomas

    Oops, i meant to say i stopped using CSV for FixedIt.

  13. Robert B

    I’d love to learn how I can set something up where I can automatically generate either CSV or ROS files. Unfortunately I’m not much of a programmer, so I’d need some sort of step-by-step process.
    I think this site has done a great job in opening up possibilities to run procedures and stuff with retrosheet-style event logs. Would love to learn more!

    Robert

  14. Great stuff. Thanks for the rosters.

    Any chance you will be able to produce rosters for the Arizona Fall League teams?

    http://mlb.mlb.com/mlb/events/winterleagues/?league=afl

    Thanks,
    Peter

  15. Sure… I added them today.

    Enjoy!

  16. […] bigger pain. Being able to import a roster to the cellphone would be most welcomed. Ben collates the MLB rosters daily on his Pitch-By-Pitch site. I don’t know how 6-4-3 handles the roster, but being able to […]

  17. Okay, I feel pretty embarrassed about this since I consider myself a computer geek…but when I save the csv files for ballscore it will not allow me to save them as ros files. I rename the file to an ros extension and it still lists it as a csv file. I really want to try this software, but this issue has me running around in circles. How can I properly import the csv files into BallScore?

  18. Bob Lankin

    Hello!

    Wondered whether it’s possible to load an as-played csv file into ballstat to use as a scoresheet for scoring.

    Thanks!

  19. William Smith

    Just want to say this is a great site. For ballstat users, save the .cvs file to where ever your rosters files are saved. Simply rename the file with .txt extention, import to Ballstat through RLM/create new roster then save.

  20. William Smith

    Sorry, I meant to say ballscore

  21. Love the fact you scrape from MLB.com. Was thinking of doing the same until I came across your site. What I’d love to see is a file with all players in the ROS format. I was thinking of scraping your site to do this but before doing so I thought I’d ask to see if you could do that.

    If not, would you mind sharing your scraping code? I’ll just do it from MLB.com myself.

  22. Pete – I added this to the nightly job that creates the roster files.

    You can access the file here.

    Just curious – how are you using the ROS info?

  23. […] I’m not exactly sure when this happened, but just today I noticed that BallStat / BallScore is now available for free!  If you run Windows, it’s definitely worth checking out.  Roster files are updated daily here. […]

  24. The Miami Marlins links don’t seem to be working. Do you have a fix?

    Thanks for your excellent site!!

    Darren

  25. Fixed. Thanks!

  26. Hi Retrosheet experts,
    I wonder if someone can help with something. I would like to create a database from Retrosheet data, and wondered if it is straightforward enough to do it in Microsoft Access. I did find a tutorial on how to accomplish this by creating a MySQL database, but not MS Access. Is the process adaptable enough such that I can use Chadwick to parse the data for MS Access instead of MySQL? If so, how can I do it? Do you know of a tutorial that explains how to do it or someone who can help guide me?

    Thank you in advance for your help with this.

    Sincerely,
    Lee

  27. Seems MLB.com has changed something again in the formatting of the rosters on the team web pages as the last 4 links I’ve tried from above now just return a file with the team name in the first line (for the Ballstat CSV links anyway – similar for other formats) The change occurred since the beginning of spring training as the links were working then.

    Hope this page will be updated as its’ an invaluable resource for us that like to keep score of MLB games throughout the season. It becomes tedious to edit cut-and-paste snapshots of each team roster page in Excel.

  28. Thanks for the heads up. I fixed the MLB files. Let me know if anything doesn’t look right. I’ll get to the MILB rosters in a few days.

  29. Thanks much for updating the links… I’ve imported about a half dozen Ballstat CSVs – the player names/numbers are fine but the B/T values aren’t being picked up correctly. I looked for a pattern today and at least on the Nationals and Reds CSVs it appears the B/T values in the very first (pitcher) line are being duplicated in the second – thus causing all the following B/T values to be shifted down/off by one line.

  30. Thanks. Try it now. I think it’s fixed.

  31. Steve Ryan

    If rosters are needed, there is also a way to load daily lineups if desired: https://groups.yahoo.com/neo/groups/ATMgrForBBW/files

  32. Getting close to the start of spring training! Not sure if anyone monitors this page anymore but seems the roster file links above are broken. When I try to download a file (of any type) I get a ‘Failed – No file’ message (using Chrome)

  33. I’m working on making sure that everything is updated now.

    Thanks!
    Ben

  34. Wow… quick service(!) Thanks – first roster file looks good…

  35. Glad to see site operational again – seemed to be offline when I first checked for spring training back in Feb.
    Not sure if anyone monitors the page anymore but, while I didn’t check every link, the half-dozen or so team rosters I’ve downloaded were blank. So seems MLB.com made some changes to the team roster pages.

Add your comment now