Hi all
I'm after a little help with regards to and if statement in Excel Power Query. I have 30 different queries called Race1, Race2 etc. The code for this simply gets information from a website that has been extracted from my worksheet, Below is an example of one of these queries, specifically, Race1.
I then have a compiled table of all 30 queries using the append feature in which i remove certain columns. This can be seen below.
My problem is, the website i extract data from will remove certain tables throughout the day from some of the URLs. When this happens this causes the appened table to get the error:
Expression.Error: The column '3' of the table wasn't found.
Details:
3
This stops the remaining queries from executing. What i would like to do is have an if statement somewhere that says, eg, "if Race1 error, do nothing, move on to Race 2 etc."
Thanks in advance
I'm after a little help with regards to and if statement in Excel Power Query. I have 30 different queries called Race1, Race2 etc. The code for this simply gets information from a website that has been extracted from my worksheet, Below is an example of one of these queries, specifically, Race1.
Code:
let
RaceList = Excel.CurrentWorkbook(){[Name="RaceTable"]}[Content],
URL = RaceList{0}[RaceURL],
Source = Web.Page(Web.Contents(URL)),
Data = Source{1}[Data]
in
Data
I then have a compiled table of all 30 queries using the append feature in which i remove certain columns. This can be seen below.
Code:
let Source = Table.Combine({#"Race 1", #"Race 2", #"Race 3", #"Race 4", #"Race 5", #"Race 6", #"Race 7", #"Race 8", #"Race 9", #"Race 10", #"Race 11", #"Race 12", #"Race 13", #"Race 14", #"Race 15", #"Race 16", #"Race 17", #"Race 18", #"Race 19", #"Race 20", #"Race 21", #"Race 22", #"Race 23", #"Race 24", #"Race 25", #"Race 26", #"Race 27", #"Race 28", #"Race 29", #"Race 30"}),
#"Removed Other Columns" = Table.SelectColumns(Source,{"3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26"})
in
#"Removed Other Columns"
My problem is, the website i extract data from will remove certain tables throughout the day from some of the URLs. When this happens this causes the appened table to get the error:
Expression.Error: The column '3' of the table wasn't found.
Details:
3
This stops the remaining queries from executing. What i would like to do is have an if statement somewhere that says, eg, "if Race1 error, do nothing, move on to Race 2 etc."
Thanks in advance
Last edited: