Reputation: 875
I wish to extract the data from this website:
https://apps.who.int/food-additives-contaminants-jecfa-database/search.aspx?fl=%2b
When I do so in Power query I only get the Kind, Name, Children, Text table.
However when doing the exact same on PowerBI this recognises the list as desired.
Can I get Power Query to recognise the data in the same way? Or is there a way to export the Query to Excel?
Upvotes: 0
Views: 667
Reputation: 875
Bit of a convoluted solution but I have subsequently found how to achieve this using Power Query in Excel. It is possible to navigate the HTML within power query to get to the raw data. Once here the data may not be adjacent to one another but this can be cleaned up easily using power query.
M Code:
let
Source = Web.Page(Web.Contents("https://apps.who.int/food-additives-contaminants-jecfa-database/search.aspx?fcc=4")),
Data0 = Source{0}[Data],
Children0 = Data0{0}[Children],
Children1 = Children0{1}[Children],
Children2 = Children1{2}[Children],
Children3 = Children2{2}[Children],
Children6 = Children3{6}[Children],
Children4 = Children6{6}[Children],
Children5 = Children4{1}[Children],
Children19 = Children5{19}[Children],
Children7 = Children19{1}[Children],
#"Expanded Children" = Table.ExpandTableColumn(Children7, "Children", {"Kind", "Name", "Children", "Text"}, {"Children.Kind", "Children.Name", "Children.Children", "Children.Text"}),
#"Expanded Children.Children" = Table.ExpandTableColumn(#"Expanded Children", "Children.Children", {"Kind", "Name", "Children", "Text"}, {"Children.Children.Kind", "Children.Children.Name", "Children.Children.Children", "Children.Children.Text"}),
#"Removed Columns" = Table.RemoveColumns(#"Expanded Children.Children",{"Kind", "Name", "Children.Kind", "Children.Name", "Children.Children.Kind", "Children.Children.Name", "Children.Children.Children", "Text"}),
#"Filled Up" = Table.FillUp(#"Removed Columns",{"Children.Text"}),
#"Filtered Rows" = Table.SelectRows(#"Filled Up", each ([Children.Children.Text] <> null and [Children.Children.Text] <> "Flavouring Agent"))
in
#"Filtered Rows"
Upvotes: 1
Reputation: 60444
It seems that Power Query in Excel does not have the Html.Table
function which is used in Power Query in Power BI.
But you can export the data as a csv, then import into Excel.
From the PQ Editor:
Export to CSV
Upvotes: 2