Hi there,
I created a query to get data from the web with multiple pages. The query works fine and updates through PowerBI desktop. However, when I try to schedule a refresh I get the following message:
"You can't schedule refresh for this dataset because the following data sources currently don't support refresh:
Discover Data Sources
Query contains unsupported function. Function name: Web.Contents"
I am not sure what is going wrong, I have been looking for previous solutions but they don't seem to work for the multiple pages problem.
Here is the Query I am using (I adapted the URL to be able to post it here):
(URL) =>
let
Source = Web.Page(Web.Contents(URL)),
Data0 = Source{0}[Data],
#"Changed Type" = Table.TransformColumnTypes(Data0,{{"Rk", Int64.Type}, {"", type text}, {"Name", type text}, {"Team", type text}, {"Overall Age", Int64.Type}, {"Overall Pos", type text}, {"Overall GP", Int64.Type}, {"Overall G", Int64.Type}, {"Overall A", Int64.Type}, {"Overall P", Int64.Type}, {"Overall PIM", Int64.Type}, {"Overall +/-", Int64.Type}, {"Goals ESG", Int64.Type}, {"Goals PPG", Int64.Type}, {"Goals SHG", Int64.Type}, {"Goals GWG", Int64.Type}, {"Goals OTG", Int64.Type}, {"Assists ESA", Int64.Type}, {"Assists PPA", Int64.Type}, {"Assists SHA", Int64.Type}, {"Assists GWA", Int64.Type}, {"Assists OTA", Int64.Type}, {"Points ESP", Int64.Type}, {"Points PPP", Int64.Type}, {"Points SHP", Int64.Type}, {"Points GWP", Int64.Type}, {"Points OTP", Int64.Type}, {"Points PPP%", Percentage.Type}, {"Time on Ice TOI", type text}, {"Time on Ice ES", type time}, {"Time on Ice PP", type time}, {"Time on Ice SH", type time}, {"per 60 All Situations G/60", type number}, {"per 60 All Situations A/60", type number}, {"per 60 All Situations P/60", type number}, {"per 60 Even-Strength ESG/60", type number}, {"per 60 Even-Strength ESA/60", type number}, {"per 60 Even-Strength ESP/60", type number}, {"per 60 Power-Play PPG/60", type number}, {"per 60 Power-Play PPA/60", type number}, {"per 60 Power-Play PPP/60", type number}, {"per Game G/GP", type number}, {"per Game A/GP", type number}, {"per Game P/GP", type number}, {"Shots SHOTS", Int64.Type}, {"Shots SH%", Percentage.Type}, {"Defensive HITS", Int64.Type}, {"Defensive BS", Int64.Type}, {"Faceoffs FOW", Int64.Type}, {"Faceoffs FOL", Int64.Type}, {"Faceoffs FO%", Percentage.Type}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"Overall PIM", "Overall +/-", "Goals ESG", "Goals PPG", "Goals SHG", "Goals GWG", "Goals OTG", "Assists ESA", "Assists PPA", "Assists SHA", "Assists GWA", "Assists OTA", "Points ESP", "Points PPP", "Points SHP", "Points GWP", "Points OTP", "Points PPP%", "Time on Ice TOI", "Time on Ice ES", "Time on Ice PP", "Time on Ice SH", "per 60 All Situations G/60", "per 60 All Situations A/60", "per 60 All Situations P/60", "per 60 Even-Strength ESG/60", "per 60 Even-Strength ESA/60", "per 60 Even-Strength ESP/60", "per 60 Power-Play PPG/60", "per 60 Power-Play PPA/60", "per 60 Power-Play PPP/60", "per Game G/GP", "per Game A/GP", "per Game P/GP", "Shots SHOTS", "Shots SH%", "Defensive HITS", "Defensive BS", "Faceoffs FOW", "Faceoffs FOL", "Faceoffs FO%", "Overall Age", "Overall Pos"})
in
#"Removed Columns"
let
Source = {1..Page},
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type text}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Column1", "Page_ID"}}),
#"Added Custom" = Table.AddColumn(#"Renamed Columns", "Page_URL", each "https://www.quanthockey.com/scripts/AjaxPaginate.php?cat=Season&pos=Players&SS=2019-20&af=0&nat=2019-20&st=reg&sort=P&so=DESC&page="&[Page_ID]&"&league=NHL&lang=en&rnd=717683913&dt=2&sd=undefined&ed=undefined"),
#"Changed Type1" = Table.TransformColumnTypes(#"Added Custom",{{"Page_URL", type text}}),
#"Invoked Custom Function" = Table.AddColumn(#"Changed Type1", "All_Pages_Scrapper", each Web_Scrapper([Page_URL])),
#"Removed Errors" = Table.RemoveRowsWithErrors(#"Invoked Custom Function", {"All_Pages_Scrapper"}),
#"Expanded All_Pages_Scrapper" = Table.ExpandTableColumn(#"Removed Errors", "All_Pages_Scrapper", {"Rk", "", "Name", "Team", "Overall GP", "Overall G", "Overall A", "Overall P"}, {"Rk", "Column1", "Name", "Team", "Overall GP", "Overall G", "Overall A", "Overall P"}),
#"Removed Columns" = Table.RemoveColumns(#"Expanded All_Pages_Scrapper",{"Page_ID", "Page_URL"}),
#"Changed Type2" = Table.TransformColumnTypes(#"Removed Columns",{{"Rk", Int64.Type}, {"Column1", type text}, {"Name", type text}, {"Team", type text}, {"Overall GP", Int64.Type}, {"Overall G", Int64.Type}, {"Overall A", Int64.Type}, {"Overall P", Int64.Type}}),
#"Renamed Columns1" = Table.RenameColumns(#"Changed Type2",{{"Column1", "Country"}})
in
#"Renamed Columns1"
Thank you very much for your help!