Culling data from NHL.com

Discussion in 'By The Numbers' started by Germant, Apr 8, 2018.

  1. Germant

    Germant Registered User

    Joined:
    Jan 3, 2016
    Messages:
    5
    Likes Received:
    1
    Trophy Points:
    6
    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?
     
    Doctor No likes this.
  2. Germant

    Germant Registered User

    Joined:
    Jan 3, 2016
    Messages:
    5
    Likes Received:
    1
    Trophy Points:
    6
    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. :)
     
  3. LeHab

    LeHab Registered User

    Joined:
    Aug 31, 2005
    Messages:
    12,001
    Likes Received:
    1,632
    Trophy Points:
    169
    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: Apr 8, 2018
    Germant and Doctor No like this.
  4. LeHab

    LeHab Registered User

    Joined:
    Aug 31, 2005
    Messages:
    12,001
    Likes Received:
    1,632
    Trophy Points:
    169
    This is what I get:

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

    To

    upload_2018-4-8_20-31-46.png
     
    Germant likes this.
  5. Doctor No

    Doctor No Registered User

    Joined:
    Oct 26, 2005
    Messages:
    7,887
    Likes Received:
    1,284
    Trophy Points:
    139
    Home Page:
  6. Germant

    Germant Registered User

    Joined:
    Jan 3, 2016
    Messages:
    5
    Likes Received:
    1
    Trophy Points:
    6
  7. Germant

    Germant Registered User

    Joined:
    Jan 3, 2016
    Messages:
    5
    Likes Received:
    1
    Trophy Points:
    6
    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 . . .
     
  8. HamiltonNHL

    HamiltonNHL Window open for 5 years

    Joined:
    Jan 4, 2012
    Messages:
    11,093
    Likes Received:
    2,644
    Trophy Points:
    157
    Location:
    Hockeyville
    You are old.

    Loved [Reveal Codes]

    :)

    WP 5.1 for Dos FTW !
     
    Kane One likes this.
  9. LeHab

    LeHab Registered User

    Joined:
    Aug 31, 2005
    Messages:
    12,001
    Likes Received:
    1,632
    Trophy Points:
    169
    You could try changing page size when in print preview. Should capture more columns if needed.
     
  10. alko

    alko Registered User

    Joined:
    Oct 20, 2004
    Messages:
    5,059
    Likes Received:
    516
    Trophy Points:
    139
    Location:
    Slovakia
    Home Page:
    If im correct, it also depends on Browser, you are using. Chrome is good.

    Had bad experience with Modzilla. Maybe things changed, never used it for years.
     
  11. Pens3peat

    Pens3peat Registered User

    Joined:
    Jun 15, 2017
    Messages:
    35
    Likes Received:
    7
    Trophy Points:
    21
  12. seventieslord

    seventieslord Student Of The Game

    Joined:
    Mar 16, 2006
    Messages:
    32,340
    Likes Received:
    1,318
    Trophy Points:
    169
    Location:
    Regina, SK
    The tips in this thread don't seem to work for me. Anything else you can suggest?
     
  13. Hockey Outsider

    Hockey Outsider Registered User

    Joined:
    Jan 16, 2005
    Messages:
    4,975
    Likes Received:
    1,468
    Trophy Points:
    149
    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.
     
    seventieslord likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
monitoring_string = "358c248ada348a047a4b9bb27a146148"