Daily Sports Stats Magic
Budget: £10 – £20 GBP
I just need some help with some really basic code.
I'm basically pulling in football data from the web and the "URL" tables that have been created change by a vlookup function with the idea that it would then pull in another teams data when the web URL is changed and the data refreshed. So far so good. It all works fine the first time round and then when it changes I get the following error:
"[Expression. Error] The column 'For Bournemouth Date' of the table wasn't found."
I have managed to trace it back to the code in the advanced editor below:
Code:
(URL) as table =>
let
Source = Web.Page(Web.Contents(URL)),
Data0 = Source{0}[Data],
#"Changed Type" = Table.TransformColumnTypes(Data0,{{"For Bournemouth Date", type date}, {"For Bournemouth Time", type time}, {"For Bournemouth Round", type text}, {"For Bournemouth Day", type text}, {"For Bournemouth Venue", type text}, {"For Bournemouth Result", type text}, {"For Bournemouth GF", Int64.Type}, {"For Bournemouth GA", Int64.Type}, {"For Bournemouth Opponent", type text}, {"For Bournemouth Att", Int64.Type}, {"Pass Types Live", Int64.Type}, {"Pass Types Dead", Int64.Type}, {"Pass Types FK", Int64.Type}, {"Pass Types TB", Int64.Type}, {"Pass Types Sw", Int64.Type}, {"Pass Types Crs", Int64.Type}, {"Pass Types TI", Int64.Type}, {"Pass Types CK", Int64.Type}, {"Corner Kicks In", Int64.Type}, {"Corner Kicks Out", Int64.Type}, {"Corner Kicks Str", Int64.Type}, {"Outcomes Cmp", Int64.Type}, {"Outcomes Off", Int64.Type}, {"Outcomes Blocks", Int64.Type}, {"Match Report", type text}})
in
#"Changed Type"
Obviously the error occurs when I change it to say Bristol City because the code it is looking on the web for Bournemouth. Could anyone help me so that "For Bournemouth Date" (and all the others) pull in the data with whatever the column header is from the web source rather than looking for what is between the quotation marks? At this point I could even just take them to point for a cell reference - Sheet1 Cell A1 for date, Cell A2 for Round etc... and create the "For (Team from Cell reference) Date" there.
I'm basically pulling in football data from the web and the "URL" tables that have been created change by a vlookup function with the idea that it would then pull in another teams data when the web URL is changed and the data refreshed. So far so good. It all works fine the first time round and then when it changes I get the following error:
"[Expression. Error] The column 'For Bournemouth Date' of the table wasn't found."
I have managed to trace it back to the code in the advanced editor below:
Code:
(URL) as table =>
let
Source = Web.Page(Web.Contents(URL)),
Data0 = Source{0}[Data],
#"Changed Type" = Table.TransformColumnTypes(Data0,{{"For Bournemouth Date", type date}, {"For Bournemouth Time", type time}, {"For Bournemouth Round", type text}, {"For Bournemouth Day", type text}, {"For Bournemouth Venue", type text}, {"For Bournemouth Result", type text}, {"For Bournemouth GF", Int64.Type}, {"For Bournemouth GA", Int64.Type}, {"For Bournemouth Opponent", type text}, {"For Bournemouth Att", Int64.Type}, {"Pass Types Live", Int64.Type}, {"Pass Types Dead", Int64.Type}, {"Pass Types FK", Int64.Type}, {"Pass Types TB", Int64.Type}, {"Pass Types Sw", Int64.Type}, {"Pass Types Crs", Int64.Type}, {"Pass Types TI", Int64.Type}, {"Pass Types CK", Int64.Type}, {"Corner Kicks In", Int64.Type}, {"Corner Kicks Out", Int64.Type}, {"Corner Kicks Str", Int64.Type}, {"Outcomes Cmp", Int64.Type}, {"Outcomes Off", Int64.Type}, {"Outcomes Blocks", Int64.Type}, {"Match Report", type text}})
in
#"Changed Type"
Obviously the error occurs when I change it to say Bristol City because the code it is looking on the web for Bournemouth. Could anyone help me so that "For Bournemouth Date" (and all the others) pull in the data with whatever the column header is from the web source rather than looking for what is between the quotation marks? At this point I could even just take them to point for a cell reference - Sheet1 Cell A1 for date, Cell A2 for Round etc... and create the "For (Team from Cell reference) Date" there.