Is it possible to get play-by-play data for an entire season in excel format?

Hey r/hockey, I'm looking to compile some data for a project I'm working on and I was wondering if there is a way to get the play-by-play breakdown of all 1230 NHL games from the 2016/17 season in an excel format?

I know NHL.com has complete play-by-play write ups however, I'd have to copy and paste all the data into excel and format - hella time consuming.

Anyway, if anyone can point me in the right direction or even suggest an ideal way to extract this data from NHL.com.

Thanks in advance!

Edit: Thank you to everyone in here who responded! I truly appreciate it. Just to let everyone know, I was able to get the data from the good people over at icydata.hockey who saved me HOURS of work. Also - y'all some smart ass mofo's, I'm ecstatic to be living in this day and age where I can get help from various sources, so easily. Thanks again to everyone!

Posted Jun 25, 2017, 7:46 PM UTC · edited

1719
N-XTLAK - NHL•

I am not a programmer but I would think this is a better question for users on subs like r/dataisbeautiful or r/coding. This is probably something that a computer program could extract and format for you.

11
types_stuffOPTOR - NHL•

Thank you for the reply.

Yea I contemplated posting to r/dataisbeautiful but felt it might be niche enough and, considering some of the brilliant minds I've seen on this sub when it comes to statistics, I figured I'd start here.

If this doesn't yield favourable results, I'll be sure to post to the other two :)

1
chiasmaticLAK - NHL•

It's not an entire season but you can export game data using the nhlscrapr package on R

6
types_stuffOPTOR - NHL•

Thank you for the reply!

I'm looking into R but I'm not very well versed with it. I'll read more and hopefully this works. Much appreciated.

2
Cronut_PIT - NHL•

Why excel?

5
types_stuffOPTOR - NHL•

No reason, I'm not technically proficient and excel is something that's easy to use.

2
ChocolateAlmondFudgeUConn Huskies - NCAA•

Corsica used to have the play-by-play files available as an R database. Those db files were usually ~1.3 GB and had over a million records. I'm not sure it's a data set you could handle in Excel.

Nonetheless, you can try reaching out to @MannyElk on twitter and see if he still has them available for download.

5
types_stuffOPTOR - NHL•

Thank you very much!

1
BiggerDMTL - NHL•

PM me, I downloaded the Corsica data before. It's too big for Excel (3 million rows iirc), but I was able to view it in Access. I'm trying to learn R right now to sift through the data.

2
WewentoMTL - NHL•

If you get a reply on that... I'd love to get it too ;)

1
BiggerDMTL - NHL•

If you know a way to share a 1+GB file, let me know. I downloaded that file before Corsica went down.

Edit: It's being uploaded to Mediafire now, but my crappy Canadian internet is struggling with a 1.3GB upload. Stay tuned!

Edit 2: Here's the link for the r data, the csv still needs a few hours to upload. http://www.mediafire.com/file/w61lwc5a5r51vjd/pbp20162017.Rda

Edit 3: Really sorry guys, the upload has failed three times now, I'll try it once more when I get back from vacation, but it's taking more than 6 hours to upload this 1.3 GB file.

Edit 4: Finally! Here's the csv file: http://www.mediafire.com/file/sloov3akoygponm/pbp.csv

2
WewentoMTL - NHL•

I think putting it on Dropbox or GoogleDrive and sharing the link is a good way to share it.

You can share it on mediafire.com too.

1
ChocolateAlmondFudgeUConn Huskies - NCAA•

16-17 data? I'd be very interested in that.

1
WewentoMTL - NHL•

Thanks!!! I'll download that tomorrow! (I only have 3G right now, I'm moving)

1
Steve_nstpbMichigan Wolverines - NCAA•

You could scrape it. I have the 15/16 one in a database file that came from game reports.

3
BiggerDMTL - NHL•

As someone who's knowledge of computers goes up to Intro to C/FORTRAN and 4 years of MATLAB wizardry, how would you recommend learning how to 'scrape' data like that?

1
Steve_nstpbMichigan Wolverines - NCAA•

I did it in R. Because I knew R best. If I was starting from scratch today I would do it in Python.

For learning how to scrape data the easiest way would probably be "requests" and "beautiful soup" in Python. Python is easy to pick up if you have any knowledge of coding which it sounds like you do, and it's useful for everything. The r/learnpython wiki is probably as good a place to start as any.

3
schmaleo505DET - NHL•

You'd need to do some extensive looping and whatnot, but scraping the data is your best option.

You can find "official game reports" from any NHL.com game recap page. If you scroll to the bottom on the right side, there's a link to them. Here's an example from a Wings v. Sens game.

You would need to loop through each game that happened, and grab each event.

There's also a sort of hidden API for the NHL.com website that I've hacked up a bit if you want to go that route. It's undocumented, but if you look at this link (https://statsapi.web.nhl.com/api/v1/game/2016020886/feed/live.gameData.status) you'll see basically the same data, but in JSON.

Are you a programmer? If so, I'm happy to bounce ideas around if you'd like.

Edit: Oh, and Excel will likely crash if you try and put that much data into it. From viewing a couple game reports, it looks like there might be ~300 events per game, which would bring you to almost a half-million records.

1
types_stuffOPTOR - NHL•

Thanks so much for the reply, and the information!

I'm not a programmer unfortunately, and the data I'm looking for is simply to find the average occurrence rate for specific events (goals, penalties, etc) so I'm not looking to drill too far in.

I was able to get the data I needed from the good folks over at icydata.hockey (thanks u/lang14) but again, thank you for your response. If I need to get more in-depth, atleast I'll have this post to refer back to!

2
schmaleo505DET - NHL•

Yeah, feel free. I started playing around with it because I'm bored, and I got the data, it's just that formatting it was a bummer. Let me know if you need more in-depth info!

1
rjweise•

I wrote the following in R. I'm sure it could be improved, but it creates play by play data in csv format. You may want to adjust the subsets it's pulling. https://github.com/rjweise/NHLscrapr/blob/master/Rcode

1
types_stuffOPTOR - NHL•

Wow, that was months ago and you still responded, thank you!! I'll look into this when I get home this evening.

1