Ratings Creation - Copying stats to spreadsheet problem

This forum is for league commissioners seeking advice when it comes to league related issues; rules, free agency system etc. / Ce forum devrait être utilisé par les commissaires qui cherches des conseils pour les aider à rouler leur ligue; règlements, systême agent libre etc.
Post Reply
Kramden23
The Addict / Le Drogué
Posts: 758
Joined: Tue May 13, 2008 8:33 pm

Ratings Creation - Copying stats to spreadsheet problem

Post by Kramden23 » Fri May 11, 2018 9:09 pm

Every year when we make new ratings for our league I simply copied the stats table from nhl.com and pasted them in an excel sheet. For years this worked perfectly and placed all the stats correctly in separate cells.

Photo Example:
Image


However this year when I copy/paste the stats in excel they are getting pasted vertically and not in the cells they're supposed to.

Photo Example:
Image


Has anyone else encountered the same problem and/or have you found a solution?
Less than 1% of americans can speak french
More than 70% of canadians can speak english

Want more answers, why limit yourself? Post in english!

User avatar
BRHL Hockey
The Passion One / Le Passionné
Posts: 170
Joined: Mon May 04, 2009 12:46 pm
Location: Denver, Colorado
Contact:

Re: Ratings Creation - Copying stats to spreadsheet problem

Post by BRHL Hockey » Sun May 13, 2018 10:59 am

Same problem

Had to switch where we gather stats from
Image

Bryce Shuck
brhlbryce@gmail.com
ICQ - 430641410
BRHL2 Cash League est. 2006 - http://new.brhl.net/

User avatar
gresh
The Passion One / Le Passionné
Posts: 186
Joined: Mon Aug 22, 2011 9:27 am
Contact:

Re: Ratings Creation - Copying stats to spreadsheet problem

Post by gresh » Mon May 14, 2018 11:53 am

On my side, I'm not using the stats page, I'm using the API.

Like this one:
http://www.nhl.com/stats/rest/skaters?i ... mary&sort=[{%22property%22:%22points%22,%22direction%22:%22DESC%22},{%22property%22:%22goals%22,%22direction%22:%22DESC%22},{%22property%22:%22assists%22,%22direction%22:%22DESC%22}]&cayenneExp=gameTypeId=3%20and%20seasonId%3E=20172018%20and%20seasonId%3C=20172018

In PHP, it's easy to extract.

To know the API to use, use Chrome, go a NHL.com stats page, press F12, press F5 to refresh the page and search for the API call (this is the tricky part).
JF Tellier
Président / DG Islanders
http://laqhl.ca
Outil de Recote: http://gresh.ca/sths/
Email: dgisl.qhls@hotmail.com

SimonT
STHS Owner / Propriétaire du STHS
Posts: 13009
Joined: Sat Oct 08, 2005 4:18 pm
Location: Montreal, Canada
Contact:

Re: Ratings Creation - Copying stats to spreadsheet problem

Post by SimonT » Tue May 15, 2018 6:54 pm

PowerShell is the answer.

Code: Select all

$JSON = Invoke-RestMethod -uri "http://www.nhl.com/stats/rest/skaters?isAggregate=false&reportType=basic&isGame=false&reportName=skatersummary&cayenneExp=gameTypeId=2 and seasonId%3E=20172018"
$Players = $JSON.Data
$Players | export-csv NHLData.csv -NoTypeInformation
P.S. For the futur user, please look at the first line for the season year / ID. Because you can also get previous year stat with this query.
-SimonT
Forum Administrator / Administrateur du Forum
STHS Owner / Propriètaire du STHS
English V2 & V3 Manual - Manuel V2 & V3 Français

Post Reply