silvanus3805
New Member
- Joined
- Feb 21, 2022
- Messages
- 17
- Office Version
- 2016
- Platform
- Windows
I have a Table With URL's that I need power query to load table form each webpage and combine it as one
The problem is , my query takes long to load the data, I tried Table.buffer but it doesn't seem to speed it up any better, How do I Edit My Code to be efficient?
1st Table Named "Engine"
here is the code that extracts from the table and makes it as one but loads very slow
let
Source = Excel.CurrentWorkbook(){[Name="Engine"]}[Content],
tbl = Table.Buffer(Table.AddColumn(Source, "Tables",each Web.Page(Web.Contents(_[Column1])){0}[Data])),
#"Removed Errors" = Table.RemoveRowsWithErrors(tbl, {"Tables"}),
#"Expanded Tables" = Table.ExpandTableColumn(#"Removed Errors", "Tables", {"Kind", "Name", "Children", "Text", "Code", "Match/Offer Type", "Home", "Draw", "Away", "Kickoff", "Return to Leagues"}, {"Data.Kind", "Data.Name", "Data.Children", "Data.Text", "Data.Code", "Data.Match/Offer Type", "Data.Home", "Data.Draw", "Data.Away", "Data.Kickoff", "Data.Return to Leagues"}),
#"Removed Other Columns" = Table.SelectColumns(#"Expanded Tables",{"Column2", "Data.Match/Offer Type", "Data.Home", "Data.Draw", "Data.Away", "Data.Kickoff"}),
#"Filtered Rows" = Table.SelectRows(#"Removed Other Columns", each ([Data.Kickoff] <> null)),
#"Renamed Columns" = Table.RenameColumns(#"Filtered Rows",{{"Column2", "Custom"}}),
#"Split Column by Delimiter" = Table.SplitColumn(#"Renamed Columns", "Data.Kickoff", Splitter.SplitTextByDelimiter("/", QuoteStyle.Csv), {"Data.Kickoff.1", "Data.Kickoff.2", "Data.Kickoff.3"}),
#"Merged Columns" = Table.CombineColumns(Table.TransformColumnTypes(#"Split Column by Delimiter", {{"Data.Kickoff.2", type text}, {"Data.Kickoff.1", type text}}, "en-US"),{"Data.Kickoff.2", "Data.Kickoff.1", "Data.Kickoff.3"},Combiner.CombineTextByDelimiter("/", QuoteStyle.None),"Data.Kickoff"),
#"Replaced Value" = Table.ReplaceValue(#"Merged Columns","-"," - ",Replacer.ReplaceText,{"Data.Match/Offer Type"}),
#"Changed Type" = Table.TransformColumnTypes(#"Replaced Value",{{"Data.Kickoff", type datetime}}),
#"Filtered Rows1" = Table.SelectRows(#"Changed Type", each Date.IsInCurrentDay([Data.Kickoff])),
#"Filtered Rows2" = Table.SelectRows(#"Filtered Rows1", each ([Data.Draw] <> "-"))
in
#"Filtered Rows2"
The problem is , my query takes long to load the data, I tried Table.buffer but it doesn't seem to speed it up any better, How do I Edit My Code to be efficient?
1st Table Named "Engine"
Column1 | Column2 |
*Special Bets* | |
Argentina Liga Profesional Argentina | |
Argentina Prim C Metro | |
Argentina Prim D Metro | |
Argentina Primera Nacional | |
Argentina Reserve League | |
Armenia Premier League |
here is the code that extracts from the table and makes it as one but loads very slow
let
Source = Excel.CurrentWorkbook(){[Name="Engine"]}[Content],
tbl = Table.Buffer(Table.AddColumn(Source, "Tables",each Web.Page(Web.Contents(_[Column1])){0}[Data])),
#"Removed Errors" = Table.RemoveRowsWithErrors(tbl, {"Tables"}),
#"Expanded Tables" = Table.ExpandTableColumn(#"Removed Errors", "Tables", {"Kind", "Name", "Children", "Text", "Code", "Match/Offer Type", "Home", "Draw", "Away", "Kickoff", "Return to Leagues"}, {"Data.Kind", "Data.Name", "Data.Children", "Data.Text", "Data.Code", "Data.Match/Offer Type", "Data.Home", "Data.Draw", "Data.Away", "Data.Kickoff", "Data.Return to Leagues"}),
#"Removed Other Columns" = Table.SelectColumns(#"Expanded Tables",{"Column2", "Data.Match/Offer Type", "Data.Home", "Data.Draw", "Data.Away", "Data.Kickoff"}),
#"Filtered Rows" = Table.SelectRows(#"Removed Other Columns", each ([Data.Kickoff] <> null)),
#"Renamed Columns" = Table.RenameColumns(#"Filtered Rows",{{"Column2", "Custom"}}),
#"Split Column by Delimiter" = Table.SplitColumn(#"Renamed Columns", "Data.Kickoff", Splitter.SplitTextByDelimiter("/", QuoteStyle.Csv), {"Data.Kickoff.1", "Data.Kickoff.2", "Data.Kickoff.3"}),
#"Merged Columns" = Table.CombineColumns(Table.TransformColumnTypes(#"Split Column by Delimiter", {{"Data.Kickoff.2", type text}, {"Data.Kickoff.1", type text}}, "en-US"),{"Data.Kickoff.2", "Data.Kickoff.1", "Data.Kickoff.3"},Combiner.CombineTextByDelimiter("/", QuoteStyle.None),"Data.Kickoff"),
#"Replaced Value" = Table.ReplaceValue(#"Merged Columns","-"," - ",Replacer.ReplaceText,{"Data.Match/Offer Type"}),
#"Changed Type" = Table.TransformColumnTypes(#"Replaced Value",{{"Data.Kickoff", type datetime}}),
#"Filtered Rows1" = Table.SelectRows(#"Changed Type", each Date.IsInCurrentDay([Data.Kickoff])),
#"Filtered Rows2" = Table.SelectRows(#"Filtered Rows1", each ([Data.Draw] <> "-"))
in
#"Filtered Rows2"