Forum Discussion
Anonymous
4 years agoNot applicable
Download zipped files from API
Hello, I am trying to extract data from an API, but the files are zipped, and I can't get Power Query to properly decode the underlying CSV file. I have tried various iterations of Mark White's BI B...
- 4 years ago
Using artemus Unzip code from here, I managed to get this to load as follows:
let Source = fn_Unzip(Web.Contents("https://www.petrinex.gov.ab.ca/publicdata/api/files/AB/VOL/2021-11/CSV")), Content = fn_Unzip(Source{0}[Content]){0}[Content], #"Imported CSV" = Csv.Document(Content,[Delimiter=",", Columns=30, Encoding=1252, QuoteStyle=QuoteStyle.None]), #"Promoted Headers" = Table.PromoteHeaders(#"Imported CSV", [PromoteAllScalars=true]) in #"Promoted Headers"
AlexisOlson
4 years agoSuper User
Using artemus Unzip code from here, I managed to get this to load as follows:
let
Source = fn_Unzip(Web.Contents("https://www.petrinex.gov.ab.ca/publicdata/api/files/AB/VOL/2021-11/CSV")),
Content = fn_Unzip(Source{0}[Content]){0}[Content],
#"Imported CSV" = Csv.Document(Content,[Delimiter=",", Columns=30, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(#"Imported CSV", [PromoteAllScalars=true])
in
#"Promoted Headers"
Anonymous
4 years agoNot applicable
Yes, works perfectly!! Thank you!