Skip to main content

How to create a CSV file with the Cloud Storage connector in Qlik Application Automation

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
Emile_Koslowski
Employee
Employee

How to create a CSV file with the Cloud Storage connector in Qlik Application Automation

Last Update:

Jun 3, 2022 8:41:27 AM

Updated By:

Emile_Koslowski

Created date:

Sep 6, 2021 9:14:15 AM

This article explains how the Cloud Storage connector can be used to create CSV files. Note that this is a generic connector that can be used with multiple platforms.

Supported platforms: 

  • Dropbox (live in Qlik Application Automation)
  • Amazon S3 (coming soon to Qlik Application Automation)
  • FTP (coming soon to Qlik Application Automation)
  • SFTP (coming soon to Qlik Application Automation)
  • Google Cloud Storage
  • Google Drive

 

Steps to create a CSV file:

This example uses Dropbox but the process is similar for the other platforms. 

  1. Search for the "Create File" block from the Cloud Storage connector and drag this inside the editor and connect it to the "Start" block.
    Emile_Koslowski_5-1626353572818.png
  2. Go to the inputs tab of the Create File block and select "Dropbox" as the connector.
  3. Specify the path for your new file, this should also include the filename and file extension. For example, "retail_contacts.csv".
    Emile_Koslowski_6-1626353668810.png
  4. Go to the datasources tab of the Create File block and click "Connect new datasource" to connect your dropbox account.
  5. Search for the "Write Line To File" block from the Cloud Storage connector and connect this to the "Create File on Dropbox" block.
  6. Go to the inputs tab of the Write Line To File block and select your file from the Create File block as the value for the File parameter.
  7. Specify the line of text you want to write to your file. This block will only allow for 1 line to be written to your file, so let's use it to write the file headers.
    1. Select CSV as Mode. 
    2. Specify the header rows and add a Linebreak from the formula picker
    3. If the data in your source might be incomplete, it's best to specify the column names in the "Column names" field to make sure that each value is mapped to the right column. 
  8. Now search for a connector you want to use as the source of records. This should be a list block. For example, the "List Contacts" block from Salesforce. Drag this block in your blend and connect your Salesforce account.
  9. Because the List Contacts block returns a list, it has a loop attached to it. When the blend is executed, the blocks inside this loop will be executed for each item in the list returned by the List Contacts block.
    1. Specify additional fields you want to retrieve from Salesforce in the Extra Fields input parameter in the inputs tab on the List Contacts block.
  10. Drag a new "Write Line To File" block inside the loop of the List Contacts block.
    1. Click the Data field in the inputs tab and select "Item" from the list returned by the List Contacts block:
      Emile_Koslowski_8-1626353819183.png
    2. Now click on the "List Contacts > Item" placeholder that appeared in the Data field and click "Add Formula" in the dropdown that appears.
    3. Search for the CSV formula. Inside the CSV formula settings specify the columns if you don't want to use all keys from the contact object. Click save, the placeholder in the Data input field should now look like the following image:
      Emile_Koslowski_9-1626353842139.png

       

  11. To finish the file, search for the "Save And Close File" block from the Cloud Storage connector and connect this to after the loop from the List contacts block.
  12. Go to the inputs tab in the "Save And Close File" block. Your automation should now look like this:
    Emile_Koslowski_2-1626353461575.png
  13. Bonus tip: add a comment to each block, this makes the automation easier to comprehend. To add a comment to a block, right-click the block and select "Edit comment'.
Labels (2)
Comments
SBDataspark
Creator
Creator

I was struggeling with adding a header to the CSV-file when I came across this article.
This article confirmed that I had set it up in the right way.

So thank you @Emile_Koslowski for this Knowledge base article!

I do have an additional suggestion for anyone that struggles with adding the header in the right way.

In step 7.2. where you add the headers to the file first you also need to add a "Linebreak" from the "Text functions".

Sebb_1-1654181284240.png

Sebb_2-1654181338444.png

Otherwise you end up with a CSV-file like this.

Sebb_4-1654180613692.png

This took me some time to figure out, because I wasn't aware of this function "Linebreak".

Hope this can help someone else in the future.

Kind regards,

Sebb

Emile_Koslowski
Employee
Employee

Hi Sebb, 

You're right, thanks for noticing this!

I've updated the article.

Kind regards,
Emile

Ken_T
Specialist
Specialist

how about, storing to a SharePoint site or to a Space Data Files ?
are these 2 possible? 

This would be more complete if the details for those were given, or a link to another article that explains these additional places folks might want to write a CSV to, from an automation

Emile_Koslowski
Employee
Employee

Hi @Ken_T ,

You can store files on SharePoint or other destinations by selecting a different connector in the Create File block.

Emile_Koslowski_0-1711028266989.png

 

It's not (yet) possible to create files directly in Qlik Cloud.

 

Contributors
Version history
Last update:
‎2022-06-03 08:41 AM
Updated by: