Create a CSV or JSON file on Amazon S3
You can use the Qlik Application Automation for OEM Amazon S3 connector to read files from S3 and create files on S3.
Please note that S3 does not support updating existing files, so if you want to append data, you typically create a new file with the old data plus the new data to append.
Below, we'll use a simple Datan automation to create a file in a bucket on Amazon S3, either using JSON format or CSV file format (comma separated values).
Create a CSV file
Example Data automation:
In the above example, we are using a variable called row
of type Object
, to create all columns of one CSV row. While the variable is an object, it will automatically be converted to a CSV line, based on the file name extension of the S3 file (see below).
First we make the variable row
empty. Next, we add a key/value for each column. We're using keys column1
, column2
etc. but the keys are not used in the CSV file, only the values are used.
After the variable is created, we use the block Add line to S3 file
to add individual lines to an S3 file. The above variable is used as Data
input for the block Add line to S3 file
:
The extension of the filename will determine the file format, so make sure to use a filename with extension .csv
.
Note: if the file already exists, it will be overwritten on each run of the Data automation, S3 does not support updating an existing file.
Make sure to add the S3 block Complete file
at the end of the Datan automation to close the file on S3.
A word about using variables to create CSV files
You do not have to use a variable in your Datan automation to create a CSV file. Instead, you could reference output from another block directly in the Data
field of the block Add line to S3 file
. Example:
In this example, one column will be created in the CSV file, for each property of the Item from Hubspot list contacts
, so the CSV file will contain name
, email
etc. However, in this example you have no control over which data is written to which column. That's why we use a variable above to have control over which columns are added.
Create a JSON file
Similar to the above example, you can also create a JSON file on S3, simply by using a filename with extension .json
in the block Add line to S3 file
.
Please note that Qlik Application Automation for OEM will automatically create an array in the JSON file, and the block Add a line to S3 file
will add items to this array.
The block Complete file
at the end will make sure the array is terminated correctly in the file.
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!