Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
madhubabum
Creator
Creator

How to unzip files in qlikview ?

Hi Experts

I have one zip file with 10 Excel files .

How to Unzip files in Qlikview (With out using Any Software like 7Z,Winrar,unzip,......etc)

Note : I don't want to install any software (Extract/Unzip data with Qlikview Script)

Thanks

1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

Actually you can do it by using the COM Shell which is built-into every single Windows by either using PowerShell or VBScript. This is the same unzip that your Windows Explorer file manager is using.

Here is the PowerShell version of it:

$shell_app=new-object -com shell.application
$filename
= "myExcelFiles.zip"
$zip_file
= $shell_app.namespace((Get-Location).Path + "\$filename")
$destination
= $shell_app.namespace((Get-Location).Path)
$destination
.Copyhere($zip_file.items(),0x14)



            0x14 means overwrite and don't prompt or show progress


Here is a one-liner of VBscript that does exactly the same:


CreateObject("shell.application").NameSpace("c:\users\a-user\downloads\destdir\").Copyhere CreateObject("shell.application").NameSpace("c:\users\a-user\downloads\p.zip").items() , 20


20 at the end means overwrite and don't show progress or prompt... if you remove the parameter you see the regular progress window ...


It has to be put in a .vbs file


This can be executed from the load script by using EXECUTE.


Like this:


EXECUTE cmd /c unzip.vbs;



A much more readable and understandable version of the VBscript would be:

set shellApp = CreateObject("shell.application")

set zip = shellApp.NameSpace("c:\users\petter\downloads\testzip\p.zip")

set dest = shellApp.NameSpace("c:\users\petter\downloads\testzip\")

dest.Copyhere zip.items() , 20



View solution in original post

14 Replies
gautik92
Specialist III
Specialist III

mayankraoka
Specialist
Specialist

This is the way you can do unzip.But you should have 7zip already installed:

To unzip the file from qlikview and script and then reload:

execute "c:\Program Files\7-Zip\7z.exe" e "C:\Ifilelocationpath\TABLE.zip" -y -oc:\destination\

Regards,

Mayank

petter
Partner - Champion III
Partner - Champion III

You can use PowerShell which is included with any Windows - but not necessarily activated. The best is to use the latest PowerShell 5 - which gives the most complete functionality for handling ZIP-files. PowerShell use the .NET built-in System.IO.Compression namespace which provides it with the necessary methods.

If you Google "Use PowerShell to Extract Zipped Files" and go to the Microsoft TechNet site you will find a recipe. 

petter
Partner - Champion III
Partner - Champion III

Actually you can do it by using the COM Shell which is built-into every single Windows by either using PowerShell or VBScript. This is the same unzip that your Windows Explorer file manager is using.

Here is the PowerShell version of it:

$shell_app=new-object -com shell.application
$filename
= "myExcelFiles.zip"
$zip_file
= $shell_app.namespace((Get-Location).Path + "\$filename")
$destination
= $shell_app.namespace((Get-Location).Path)
$destination
.Copyhere($zip_file.items(),0x14)



            0x14 means overwrite and don't prompt or show progress


Here is a one-liner of VBscript that does exactly the same:


CreateObject("shell.application").NameSpace("c:\users\a-user\downloads\destdir\").Copyhere CreateObject("shell.application").NameSpace("c:\users\a-user\downloads\p.zip").items() , 20


20 at the end means overwrite and don't show progress or prompt... if you remove the parameter you see the regular progress window ...


It has to be put in a .vbs file


This can be executed from the load script by using EXECUTE.


Like this:


EXECUTE cmd /c unzip.vbs;



A much more readable and understandable version of the VBscript would be:

set shellApp = CreateObject("shell.application")

set zip = shellApp.NameSpace("c:\users\petter\downloads\testzip\p.zip")

set dest = shellApp.NameSpace("c:\users\petter\downloads\testzip\")

dest.Copyhere zip.items() , 20



petter
Partner - Champion III
Partner - Champion III

Did you try out the suggestion I provided?

madhubabum
Creator
Creator
Author

Working fine

Thanks

petter
Partner - Champion III
Partner - Champion III

Good could you please close the thread by marking it as answered?

Saravanan_Desingh

Hi petter.skjolden

I was trying to unzip a web file (sharepoint file). But it is not unzipping the file. Even I'm not getting any popup if I use

MsgBox(Err.Description).

Can you please help me? I'm not good in VBS.

petter
Partner - Champion III
Partner - Champion III

You can't unzip a web file. Unzipping works only on local files. So the file has to be downloaded first from SharePoint and then it can be unzipped.