Importing web data with Power Query

Chippy68

New Member
Joined
Feb 19, 2018
Messages
13
Hi Guys,

I have built a pretty cool fully automated golf pool spreadsheet and discovered that I can bring in the Live Scoring from the web which would COMPLETELY automate the process (and look pretty fancy in the process). The problem is I've never used Power Query, but I have the M-Code that I need to use to perform this function. I have Office 365 ProPlus. Any chance anyone can walk me through getting this into Power Query and then into my existing workbook. i would also just like to have the players Full Name and Total Score, I don't need round by round scoring. Obviously looking to have this setup before the Masters which starts next week.

Appreciate any help I can get.

Here is the code:

PowerQuery works with the Golf Channel's website. This is the M-code for PQ.

let
Source = Web.Page(Web.Contents("http://www.golfchannel.com/tours/pga-tour/2017/masters-tournament/")),
Data0 = Source{0}[Data],
#"Changed Type" = Table.TransformColumnTypes(Data0,{{"", type text}, {"POS", type text}, {"MOV", type text}, {"PLAYER", type text}, {"OVERALL", type text}, {"THRU", type text}, {"RND", type text}, {"R1", type text}, {"R2", type text}, {"R3", type text}, {"R4", type text}, {"TOT", type text}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"", "MOV"}),
#"Filtered Rows" = Table.SelectRows(#"Removed Columns", each ([POS] <> "typeof(mps)=='object' && typeof(mps.getAd)=='function' && document.write(mps.getAd('midbanner1'));#(cr)#(lf)mps._execAd(""midbanner1"");" and [POS] <> "typeof(mps)=='object' && typeof(mps.getAd)=='function' && document.write(mps.getAd('midbanner2'));#(cr)#(lf)mps._execAd(""midbanner2"");")),
#"Replaced Value" = Table.ReplaceValue(#"Filtered Rows",null,"",Replacer.ReplaceValue,{"R1"}),
#"Replaced Value1" = Table.ReplaceValue(#"Replaced Value",null,"",Replacer.ReplaceValue,{"R2", "R3", "R4", "TOT"})
in
#"Replaced Value1"

Happy Easter
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Thanks for this but I don't know where to put this or the steps to do it. I have never used power query....Can you walk me through it?

I have it automated through google sheets because I was able to find a step by step walk through but I want it in Excel.

Thanks
 
Upvote 0

Forum statistics

Threads
1,223,902
Messages
6,175,278
Members
452,629
Latest member
SahilPolekar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top