Culling data from NHL.com

Germant

Registered User
Jan 3, 2016
5
1
I used to copy and paste data from tables found on nhl.com/stats (e.g. NHL.com - Stats).

It was easy, highlight, copy, go into excel, paste.

The site doesn't allow that any longer as pasting really screws up the format.

Does anybody know an easy workaround? I'm not familiar with webscraping but if that's the only way, can somebody point me to a place where I can learn?
 
  • Like
Reactions: Doctor No

Germant

Registered User
Jan 3, 2016
5
1
Oh, and when pasting TOI into excel, some cells are converted into dates. I've googled this problem but couldn't find a solution. If anybody knows a workaround to either this problem or the above problem and could shed some light on it, I'd forever be grateful. :)
 

LeHab

Registered User
Aug 31, 2005
15,957
6,259
Google around for NHL REST API stats for automated scraping of stats. There are also tools which will do the job for you such as : nhlscrapi: NHL Scraper API — nhlscrapi documentation

If you just want to copy & paste then highlight and select rows you want, right click to print. In print preview you may want to set the page to landscape. Copy Rows then paste into Excel (2010 in my case). You should have a single column and each row with data separated by a space. In Excel, go to Data then use text to columns with space as delimiter.
 
Last edited:

LeHab

Registered User
Aug 31, 2005
15,957
6,259
This is what I get:

upload_2018-4-8_20-31-4.png


To

upload_2018-4-8_20-31-46.png
 
  • Like
Reactions: Germant

Germant

Registered User
Jan 3, 2016
5
1
Thanks LeHab and Doctor No.

Just through google I had found that NHLscraper link but I was hoping for an easier solution because, well, because I'm old and learning what the heck a json file was would've likely killed me. But right clicking, print, and then copying the result from print preview really did the trick quite nicely.

I just paste that into Word Perfect, replace all the HRt (Hard Return) with Left Tab and then copy and paste right into excel.

On some of the reports, I'm not sure Landscape will get all the data though so I might still have to learn that NHLscraper though. Fingers crossed . . .
 

LeHab

Registered User
Aug 31, 2005
15,957
6,259
Thanks LeHab and Doctor No.

Just through google I had found that NHLscraper link but I was hoping for an easier solution because, well, because I'm old and learning what the heck a json file was would've likely killed me. But right clicking, print, and then copying the result from print preview really did the trick quite nicely.

I just paste that into Word Perfect, replace all the HRt (Hard Return) with Left Tab and then copy and paste right into excel.

On some of the reports, I'm not sure Landscape will get all the data though so I might still have to learn that NHLscraper though. Fingers crossed . . .

You could try changing page size when in print preview. Should capture more columns if needed.
 

Hockey Outsider

Registered User
Jan 16, 2005
9,126
14,337
The tips in this thread don't seem to work for me. Anything else you can suggest?

The short answer is - there isn't a good way.

For example if you copy the standard player stats (23 columns), it would copy into Excel as 23 rows. Then the second player's stats (also 23 columns) becomes rows 24-46, etc.

You can then manually add a formula in row 1. For example, cell B1 = A2, cell C1 = A3, cell D1 = A4, etc. Then paste that every 24th row. This will pick up all the data and convert it into one row with the 23 columns.

If you design the formula properly, it's perfectly accurate, but obviously this is inefficient.
 
  • Like
Reactions: seventieslord

Ad

Upcoming events

Ad

Ad