Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

aaroncouran
Contributor III

Zipped Files as a Data Source?

I need to pull some files from an FTP that are in a zipped file.  Is it possible for QlikView to extract the csv's from a zipped folder?  I think the answer is no, but worth a shot on the forum here.

Or maybe there is a utility that can automatically unzip and extract data from an FTP.

Tags (1)
8 Replies
MVP & Luminary
MVP & Luminary

Re: Zipped Files as a Data Source?

Hi Aaron,

I know that the CsvJdbc driver has this feature: http://csvjdbc.sourceforge.net

Maybe there are equivalent ODBC/OLEDB drivers. Or, you try our JDBC Connector.

Best regards,

Ralf

Not applicable

Re: Zipped Files as a Data Source?

If the names of the files are fixed then u can write a batch command for copying and extracting the file, call the batch file in the qvd maker or run it through the scheduler and then load that file in Qlikview.

MVP & Luminary
MVP & Luminary

Re: Zipped Files as a Data Source?

Yeah of course, but this all needs extra time..

Not applicable

Re: Zipped Files as a Data Source?

U can extract the file from the QVD maker itself using the execute command but i dont know if the file can be copied from the FTP server using the execute command.

robobi_co_za
New Contributor

Re: Zipped Files as a Data Source?

Hi there Aaron

I tried this and it works - Thanks to eHow

  • 1
    • Click "Start", "All Programs", "Accessories", "Notepad" to open Windows Notepad.
  • 2
    • Copy and paste the following VBS code into the Notepad window:

Function Unzip(strFileName,strFolderName)Dim objshellDim objfso

' Create Shell.Application so we can use the CopyHere method

Set objshell = CreateObject("Shell.Application")

' Create FileSystemObject so we can use FolderExists and CreateFolder if necessary

Set objfso = CreateObject("Scripting.FileSystemObject")

' Create folder to receive files if it doesn' t already exist

If Not objfso.FolderExists(strFolderName) Then objfso.CreateFolder strFolderName

' Use CopyHere to extract files

objshell.NameSpace(strFolderName).CopyHere

objshell.NameSpace(strFileName).ItemsSet

objfso = NothingSet objshell = NothingEnd Function

'Put your own zip file name and folder name inside the quotes in the next line

Unzip "C:\Test\Test.zip","C:\Test\Testing"

  • 3
    • Edit the last line to substitute your own zip file name and folder name for the examples given inside the quotation marks. You can specify an existing folder or not. The script will create the folder if it doesn't already exist.
  • 4
    • Click "File", "Save As" to open the Save As dialog window. Type "extractzip.vbs" (without the quotes) in the "File Name" box. Select "All Files (*.*)" from the "Save As Type" drop-down. Click the "Save" button to save the new VBS file.
  • 5

          enter the following command in your Qlikview script editor:

                         execute cmd.exe /c "C:\Data\extractzip.vbs"

aaroncouran
Contributor III

Re: Zipped Files as a Data Source?

Thanks for all the suggestions.  I ended up using a couple bat scripts and an unzip utility to accomplish this, and execute them in my QV script.  Thanks to everybody for their suggestions!

MVP & Luminary
MVP & Luminary

Re: Zipped Files as a Data Source?

Btw. we have developed a component which can read zipped CSV files (e.g. from a FTP server) and it provides this as a web source via URL to QlikView.. So you would not need to do any batch processing, just read the data as from a web source.

aaroncouran
Contributor III

Re: Zipped Files as a Data Source?

Well, the requirement ended up changing.  I ultimately had to extract from a network source so no FTP required. The only thing I needed to do was move the file for archiving and unzip it.

I would be interested in obtaining your component for future use (if it is free).

Best regards,

Aaron