Qlik Community

QlikView Documents

Documents for QlikView related information.

Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER

Accessing an FTP Server from QlikView Expressor Datascript

Not applicable

Accessing an FTP Server from QlikView Expressor Datascript

Originally published on 07-20-2011 02:30 AM

There are two ways to access an FTP server from expressor Datascript.

  1. Use the Windows ftp utility to download or upload one or more files.
  2. Use the expressor Datascript cURL module to download or upload content directly to/from memory.

Using the Windows FTP Utility

With this approach, use the following syntax for the ftp utility command.

ftp -s:filename host

Where host is the name or IP address of the computer running the FTP server and filename is the path\name of a text file that includes a list of the responses you must provide to connect to the server and the commands you want to execute.

For example, to download a specific file, the command file could contain the following entries.

cd ...
get file(s)_to_download

Username and password are the credentials needed to access the FTP server and the following lines are the commands you want to execute. The cd command is performed on the FTP server.  To upload a file, simply replace the get statement with a put statement.  You can put the command file into the external subdirectory under the project directory.  By following this practice, the command file will be in the same directory from which the dataflow runs and you will not need to provide the path to this file's location as part of the -s: argument.

In order to run the ftp command, use the os.execute function.

When you use this approach to download a file, the file is written into the same directory from which the dataflow runs.  Consequently, if your code later reads the contents of this file, use dot as the path.  In the  following screen shot, the Read Custom operator downloads and processes  a file where each line in the file contains four fields that are used  to initialize the attributes of the record emitted by the operator.  The  code also accounts for the fact that the first line in the file is a  header row.  Also note the use of the os.getenv function to retrieve  environment settings.


Using the Expressor Datascript cURL Module

With this approach, the contents of the downloaded file are not actually written to disk, but are stored in memory allocated to the executing dataflow.  Because of the specialized coding that this approach requires, it is probably best to isolate this code in a helper function or Datascript Module.

The following code illustrates how to use this approach.


This helper function returns a string that contains the contents of the downloaded file.  Within this string, each line in the source file is terminated with \r\n, so when you parse the string to extract the individual lines, you can use the character pattern "%c+" as the line delimiter.

Labels (1)
Version history
Revision #:
1 of 1
Last update:
‎2012-07-23 07:58 PM
Updated by: