Forum Discussion
Call web API, receive ZIP, decompress multiple JSON files, Load Them
- Anonymous8 years ago
dyingod,
Yes, File.Contents function requires path parameter.
In addition, I haven't found any built-in decompress function that can be used to decompress .zip file. Is there any possibility that your web service return .gzip file? If so, you can use Binary.Decompress to automatically proceed this transformation.
Regards,
Lydia
dyingod,
Create the unzip function as described in this blog: http://sql10.blogspot.sg/2016/06/reading-zip-files-in-powerquery-m.html . Then invoke the function and create a custom column in the returned table. There is an example for your reference.
Regards,
Lydia
Hey Lydia!
Thanks so much for this. I had also looked into that link but couldn't manage to do anything with it.
I get stuck here:
let
Source = File.Contents("[Full path to your zip file]"),
Files = UnzipContents(Source)
in
Files
At the [Full path to your zip file], which make me think of a place in my drive but obviously it's not as it's within Power BI so what do I put in there? I tried calling the query with the ZIP by name but that didn't work. I really am a newbie. :(
I think the Custom Column trick sounds amazing and I never thought that possible... but I need to get over this other obstacle first. Can I call on your awesome help again? :)
Thank you!
Rafa
- Anonymous8 years agoNot applicable
dyingod,
Is there any possiblity that you download the zip file to your computer from web?
Regards,
Lydia- dyingod8 years agoHelper I
Hey Lydia,
You mean outside PowerQuery? PowerQuery does download it and show it to me as a file:
The reason I'm trying to do it all via Power Query is just so it's automated.
Or maybe I am wrong in assuming that file that returns in the screenshot is the actual zip?
This is the ZIP file that contains 50+ JSON files I mentioned in the title.
Thanks Lydia!
Rafa
- Anonymous8 years agoNot applicable
dyingod,
Yes, File.Contents function requires path parameter.
In addition, I haven't found any built-in decompress function that can be used to decompress .zip file. Is there any possibility that your web service return .gzip file? If so, you can use Binary.Decompress to automatically proceed this transformation.
Regards,
Lydia
- mike_honey6 years agoMemorable Member
Try changing the line:
Source = File.Contents(...
to:
Source = Web.Contents(...