Forum Discussion
JanD
4 years agoFrequent Visitor
Extract data from a chart on website
Hello everyone, I woudl like to ask for an advise how to extract data from a specific object (Chart) on a website. My intension is to get daily values of mutual funds into Power BI, howover so ...
AlexisOlson
4 years agoSuper User
The Historical Data tab should be friendlier to work with:
It has a download option that exports CSV but you could also connect to the web page via Power Query with a query like this:
let
Source = Web.BrowserContents("https://finance.yahoo.com/quote/WPLCX/history?p=WPLCX"),
#"Extracted Table From Html" = Html.Table(Source, {{"Column1", ".Pend\(10px\)"}, {"Column2", ".Pend\(10px\) + *"}, {"Column3", ".Pstart\(10px\):nth-child(3)"}, {"Column4", ".Pstart\(10px\):nth-child(4)"}, {"Column5", ".Pstart\(10px\):nth-child(5)"}, {"Column6", ".Pstart\(10px\):nth-child(6)"}}, [RowSelector=".Pend\(10px\)"]),
#"Changed Type" = Table.TransformColumnTypes(#"Extracted Table From Html",{{"Column1", type date}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}, {"Column5", type text}, {"Column6", type text}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Column1", "Date"}, {"Column2", "Open"}, {"Column3", "High"}, {"Column4", "Low"}, {"Column5", "Close"}, {"Column6", "Adj Close"}})
in
#"Renamed Columns"