Forum Discussion
Connect Powerbi to Github
I am trying to load a github repo into powerbi ( https://github.com/Laila92/COVID-19/tree/master/csse_covid_19_data)
I followed this tutorial (https://thinkaboutit.be/2018/03/connect-to-github-microsoft-al-with-power-bi/) , and am able to connect to the Github repo but not seeing the actual data. Instead i see like how many people contributed.
How do I load the actual data into Powerbi?
Hi Anonymous ,
We can create a blank query and use following query in Advanced Editor to meet your requirement:
let Source = List.Dates(#date(2020,1,22),Duration.Days(DateTime.Date(DateTime.LocalNow())-#date(2020,1,22)),#duration(1,0,0,0)), #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Added Custom" = Table.AddColumn(#"Converted to Table", "Custom", each Date.ToText([Column1],"MM-dd-yyyy")), #"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom.1", each Table.PromoteHeaders(Csv.Document(Web.Contents("https://raw.githubusercontent.com",[RelativePath="/Laila92/COVID-19/master/csse_covid_19_data/csse_covid_19_daily_reports/"&[Custom]&".csv"]),[Delimiter=",", Columns=6, Encoding=65001, QuoteStyle=QuoteStyle.None]),[PromoteAllScalars=true])), #"Removed Errors" = Table.RemoveRowsWithErrors(#"Added Custom1", {"Custom.1"}), #"Expanded Custom.1" = Table.ExpandTableColumn(#"Removed Errors", "Custom.1", {"Province/State", "Country/Region", "Last Update", "Confirmed", "Deaths", "Recovered"}, {"Province/State", "Country/Region", "Last Update", "Confirmed", "Deaths", "Recovered"}) in #"Expanded Custom.1"Please also refer to this similar thread: https://community.powerbi.com/t5/Desktop/Get-data-from-web-cannot-bring-the-table/td-p/974083
Best regards,
3 Replies
- v-lid-msftCommunity Support
Hi Anonymous ,
We can create a blank query and use following query in Advanced Editor to meet your requirement:
let Source = List.Dates(#date(2020,1,22),Duration.Days(DateTime.Date(DateTime.LocalNow())-#date(2020,1,22)),#duration(1,0,0,0)), #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Added Custom" = Table.AddColumn(#"Converted to Table", "Custom", each Date.ToText([Column1],"MM-dd-yyyy")), #"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom.1", each Table.PromoteHeaders(Csv.Document(Web.Contents("https://raw.githubusercontent.com",[RelativePath="/Laila92/COVID-19/master/csse_covid_19_data/csse_covid_19_daily_reports/"&[Custom]&".csv"]),[Delimiter=",", Columns=6, Encoding=65001, QuoteStyle=QuoteStyle.None]),[PromoteAllScalars=true])), #"Removed Errors" = Table.RemoveRowsWithErrors(#"Added Custom1", {"Custom.1"}), #"Expanded Custom.1" = Table.ExpandTableColumn(#"Removed Errors", "Custom.1", {"Province/State", "Country/Region", "Last Update", "Confirmed", "Deaths", "Recovered"}, {"Province/State", "Country/Region", "Last Update", "Confirmed", "Deaths", "Recovered"}) in #"Expanded Custom.1"Please also refer to this similar thread: https://community.powerbi.com/t5/Desktop/Get-data-from-web-cannot-bring-the-table/td-p/974083
Best regards,- stephenmbassettFrequent Visitor
That is a great solution! However, it's only pulling data from 1/22/2020 - 3/18/2020.
So, I've changed the Relative Path in your code to go directly to the Johns Hopkins github:
let Source = List.Dates(#date(2020,1,22),Duration.Days(DateTime.Date(DateTime.LocalNow())-#date(2020,1,22)),#duration(1,0,0,0)), #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Added Custom" = Table.AddColumn(#"Converted to Table", "Custom", each Date.ToText([Column1],"MM-dd-yyyy")), #"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom.1", each Table.PromoteHeaders(Csv.Document(Web.Contents("https://raw.githubusercontent.com",[RelativePath="/CSSEGISandData/COVID-19/tree/master/csse_covid_19_data/csse_covid_19_daily_reports/"&[Custom]&".csv"]),[Delimiter=",", Columns=6, Encoding=65001, QuoteStyle=QuoteStyle.None]),[PromoteAllScalars=true])), #"Removed Errors" = Table.RemoveRowsWithErrors(#"Added Custom1", {"Custom.1"}), #"Expanded Custom.1" = Table.ExpandTableColumn(#"Removed Errors", "Custom.1", {"Province/State", "Country/Region", "Last Update", "Confirmed", "Deaths", "Recovered"}, {"Province/State", "Country/Region", "Last Update", "Confirmed", "Deaths", "Recovered"}) in #"Expanded Custom.1"But there is some problem. After I load the data into Advanced Editor, here is the outcome. No data:
I would appreciate any help! Thank you.
-Stephen