Forum Discussion
Append Data with dynamic source
- Anonymous6 years ago
Hi,
you could try in this way:
- Create a parameter TableNumber, type text and set = 1
- Import table 1 from the web site as query 1
- In the second step of query 1 ("Extracted Table From Html") substitute all
DIV.card--clean:nth-child(1)
with
DIV.card--clean:nth-child("&TableNumber&")
so you are parametrizing your query.
- Then Create Function from this query and call it TableReader
- Create a List of Number from 1 to N
- Transform to a table
- Add a column invoking TableReader function using first column as parameter
- Remove Errors
- Expand Column selecting column you need
Enjoy.
Your Final Query M Code must be something like this:
let
NumberRange = {1..20},
#"Converted to Table" = Table.FromList(NumberRange, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "TableNumber"}}),
#"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"TableNumber", type text}}),
#"Invoked Custom Function" = Table.AddColumn(#"Changed Type", "Table", each TableReader([TableNumber])),
#"Removed Errors" = Table.RemoveRowsWithErrors(#"Invoked Custom Function", {"Table"}),
#"Expanded Table" = Table.ExpandTableColumn(#"Removed Errors", "Table", {"KICK OFF", "HOME TEAM", "% CHANCE", "HOME ODDS", "DRAW ODDS", "AWAY ODDS", "% CHANCE_1", "AWAY TEAM", "PREDICTION"}, {"KICK OFF", "HOME TEAM", "% CHANCE", "HOME ODDS", "DRAW ODDS", "AWAY ODDS", "% CHANCE_1", "AWAY TEAM", "PREDICTION"})
in
#"Expanded Table"Regards
Lorenzo
You are right! Sorry for that, please find the page below
https://oddslot.com/odds/
The problem here is that the tables can go from 1 to X and I don't know how to make it dynamic.
Thanks for the help!
Hi,
you could try in this way:
- Create a parameter TableNumber, type text and set = 1
- Import table 1 from the web site as query 1
- In the second step of query 1 ("Extracted Table From Html") substitute all
DIV.card--clean:nth-child(1)
with
DIV.card--clean:nth-child("&TableNumber&")
so you are parametrizing your query.
- Then Create Function from this query and call it TableReader
- Create a List of Number from 1 to N
- Transform to a table
- Add a column invoking TableReader function using first column as parameter
- Remove Errors
- Expand Column selecting column you need
Enjoy.
Your Final Query M Code must be something like this:
let
NumberRange = {1..20},
#"Converted to Table" = Table.FromList(NumberRange, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "TableNumber"}}),
#"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"TableNumber", type text}}),
#"Invoked Custom Function" = Table.AddColumn(#"Changed Type", "Table", each TableReader([TableNumber])),
#"Removed Errors" = Table.RemoveRowsWithErrors(#"Invoked Custom Function", {"Table"}),
#"Expanded Table" = Table.ExpandTableColumn(#"Removed Errors", "Table", {"KICK OFF", "HOME TEAM", "% CHANCE", "HOME ODDS", "DRAW ODDS", "AWAY ODDS", "% CHANCE_1", "AWAY TEAM", "PREDICTION"}, {"KICK OFF", "HOME TEAM", "% CHANCE", "HOME ODDS", "DRAW ODDS", "AWAY ODDS", "% CHANCE_1", "AWAY TEAM", "PREDICTION"})
in
#"Expanded Table"
Regards
Lorenzo