Forum Discussion
Importing .gz file into PowerBi how to do this
- 1 year ago
Hi jaryszek,
Binary.Decompress reads the .gz file into Power Query memory and decompresses it during the data load or refresh. The time it takes depends mainly on the compressed file size, where the file is stored and the memory or the speed of your computer. For most of the files it is very fast, but very large files can take longer because the full uncompressed data has to be kept in the memory while it is processed.
If this post helps in resolving the issue, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thanks and regards,
Anjan Kumar Chippa
Hi jaryszek,
Thank you for reaching out to Microsoft Fabric Community.
Power BI Desktop and Power Query do not natively read .gz files directly, they can read the uncompressed data inside like .csv or .json. Power bi can load a .gz file directly if it is a standard gzip-compressed csv.
- Open Power BI Desktop --> Get data --> Blank query. In the query editor choose Advanced Editor and paste the below M code:
let
Source = File.Contents("file path"),
Decompressed = Binary.Decompress(Source, Compression.GZip),
CSV = Csv.Document(Decompressed, [Delimiter=",", Encoding=65001, QuoteStyle=QuoteStyle.Csv])
in
CSV
- Update the file path to the .gz file and click Done.
This decompresses the .gz and parses the csv in one step without needing external tools. If the .gz contains something other than a single csv file like for example .tar.gz archive, it must be extracted before importing into power bi.
If this post helps in resolving the issue, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thanks and regards,
Anjan Kumar Chippa
- jaryszek1 year agoSuper User
Hi,
thanks.
How this function : Binary.Decompress is working? It is decompressing file inside power query memory?
What it is a time for it?
Best,
Jacek- v-achippa1 year agoCommunity Support
Hi jaryszek,
Binary.Decompress reads the .gz file into Power Query memory and decompresses it during the data load or refresh. The time it takes depends mainly on the compressed file size, where the file is stored and the memory or the speed of your computer. For most of the files it is very fast, but very large files can take longer because the full uncompressed data has to be kept in the memory while it is processed.
If this post helps in resolving the issue, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thanks and regards,
Anjan Kumar Chippa