1. Home
  2. Using Warewolf
  3. Creating a CSV file using Warewolf

Creating a CSV file using Warewolf

Comma Separated Value (CSV) files are often used as a way of storing structured data by separating each field value by a comma. You can easily create a CSV file in Warewolf using the pre-built tools and connectors in the toolbox. Follow the steps below to create a CSV file in Warewolf:

    1. Create a new service by clicking the New button in the main tool bar on the left. Click New - Button on the main tool bar as seen in the Warewolf Studio
    2. Search for the Assign Tool in the Tool Box. Drag and drop the Assign Tool onto the design surface.Assign Tool as seen in Tool Box in the Warewolf Studio
    3. Open the Assign Tool into large view by double clicking the header section of the tool. Assign values to your variables and then click Done. The large view will now close.Assign Tool in large view in Warewolf
    4. Search for the For Each tool in the Tool Box and connect it to the Start Node on the design surface.
    5. Drag the existing Assign and drop it into the For Each tool where it says, “Drop Activity Here”. You can then select a specific set of indexes to be specified by range, CSV, no. of executions or every index in the given recordset.
    6. Select *in Range, add in the new assigned values (in this example, 14).For Each tool used in the CSV article in Warewolf
    7. Search for the Data Merge tool in the Tool Box and connect it to the For Each
    8. Double click to open the tool in large view. In the Input field, enter the variable data that you set in the Assign tool in Step 3. Select Chars in the With Column and add a comma (,) in the Using Select Align to the left. For the last record in the Input field, you will need to select New Line in the With field. This will create a new line for your next row of data.
    9. In the Result Field, name your Result [[CSV]] and click Done.Data Merge tool as seen in the How to create a CSV in Warewolf article
    10. Drag and Drop the Write File tool onto the Design Surface and connect it to the Data Merge
    11. Type in the name of the full path and file name in the File Name. In this example we are using c:\temp\csvtest.csv. Do not forget to add the .csv to the end of the file name.
    12. In the Contents field add [[CSV]]. This is the variable specified in the Result field of the Data Merge.
    13. Add [[result]] into the Result field.Write File as seen in Warwolf Tools
    14. In the Variables list, mark the data recordset items as Output.
    15. To Debug in your browser, press the shortcut key F7.CSV Files Debug in Browser
    16. Your CSV file will be in the location in which you assigned it to in the Write File tool. To access it, go to your Windows Explorer. Find your C: Drive and the folder and open it. It should be in an Excel format or depending on the default programme on your computer that can read CSV files.File Location for CSV file as seen in the Warewolf KB article on CSVs
    17. Click on the file and it will open in Excel.
FacebookTwitterLinkedInGoogle+Email
Updated on November 10, 2017

Was this article helpful?

Related Articles