Forum Discussion

AllanBerces's avatar
AllanBerces
Post Prodigy
1 year ago
Solved

Zip function from MARK WHITE

Hi good day, Can anyone share the query function by MARK WHITE, coz now show error on his page.     Thank you
  • 123abc's avatar
    123abc
    1 year ago

    Here’s a general approach to decompress ZIP files in Power Query:

    1. Load the ZIP file:

      let
          Source = Binary.Buffer(File.Contents("path_to_your_zip_file.zip"))
      in
          Source
    2. Extract the contents:

      let
          Source = Binary.Buffer(File.Contents("path_to_your_zip_file.zip")),
          ZipStart = Binary.Start(Source, 4),
          ZipEnd = Binary.End(Source, 4),
          ZipContents = Binary.Middle(Source, ZipStart, ZipEnd)
      in
          ZipContents
    3. Convert the binary data to a table:

      let
          Source = Binary.Buffer(File.Contents("path_to_your_zip_file.zip")),
          ZipStart = Binary.Start(Source, 4),
          ZipEnd = Binary.End(Source, 4),
          ZipContents = Binary.Middle(Source, ZipStart, ZipEnd),
          TableFromZip = Table.FromList(ZipContents, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
      in
          TableFromZip

    Copied from AI Tool.