Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
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 Blog solution (which I have simply copied & pasted, I am completely ignorant of how it works), but I run into "An error occurred in the ‘’ query. Expression.Error: We cannot convert a value of type Binary to type Text."
Is there a way to pull a zipped file directly from an online data source? An example file is:
https://www.petrinex.gov.ab.ca/publicdata/api/files/AB/VOL/2021-11/CSV
Thanks for any help you can provide!
Solved! Go to Solution.
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"
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"
Yes, works perfectly!! Thank you!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
27 | |
26 | |
21 | |
12 | |
10 |
User | Count |
---|---|
27 | |
25 | |
22 | |
17 | |
13 |