Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.
Endpoint Management Community Blog

Workflow Tutorial: Integrating CSV Files

Created: 18 Mar 2008 • Updated: 16 Apr 2008 • 6 comments
Craig Walker's picture
+1 1 Vote
Login to vote

Readin', writin' and CSV files. Sounds like a good time. Create a project to make a copy of the selected CSV file using the ReadCsvFromFile component and the WriteDynamicDataToCsv component.

Prerequisite: A file saved in the CSV format. A sample can be created using Microsoft Excel.

Objective: To learn how to use the ReadCsvFromFile component, the WriteDynamicDataToCsv component and the WriteFile component.

Estimated time to complete: 30 minutes

Step 1: Create a new Decision Only project.

Drag and drop the ReadCsvFromFile and the WriteDynamicDataToCSV components from the Components palette under the Process Components / Dynamic Data category.

Drag and drop the WriteFile component from the Input Output / Files category.

Link the components together as shown below:

Step 2: Set the Input Data as shown below:

Step 3: Right click on the ReadCsvFromFile component and select Edit Component. Click the selector box next to the File field. Select 'CSVFile' as the variable name. Also, in the Output Variable Name selector box set it as 'RetValue'.

Step 4: Right click on the WriteDynamicDataToCSV component and select Edit Component. Click the selector button next to the Collection field. Click on the Add Array button in the Variable Data tab and set the variable as 'RetValue'.

Step 5: Click the selector button next to the File field. Select 'CSVFile' as the variable name.

Step 6: Right click on the WriteFile component and select Edit Component. Set the File Variable Name as 'CSVFile'.

Step 7: Set the Output File Name by entering a file path in the Constant Value tab e.g. e :\newcsv.csv

Step 8: Save and Run the project. Click the Run project button on the toolbar (bug with green arrow over it).

Step 9: Double click Execute and click the selector button next to the CSV File field. Click the selector button next to the Contents field.

Step 10: Select a CSV file and click Open.

Step 11: The results are displayed in the Execution window. In the respective folder a copy of selected file will be created with the given name.

Step 12: Finished!

Comments 6 CommentsJump to latest comment

scottwed's picture

Change title to CSV not CVS

Scott Wedekind

Login to vote
Admin's picture

Ah, that makes much more sense ;-)

Thanks for the feedback, Scott.


Login to vote
Robert Lundsten's picture


How can I manipulate the CSV data before writing it to the file again?
I want also want to read and present the CSV data in a grid. Is that possible?


Login to vote
ChrisBern's picture

a) The CSV data that gets read in will be available in your Workflow process stream as an array (aka a collection).  So you can work with the data in an array through various components, e.g. the ones in the Collection Handling category of the Workflow toolbox.  For example you could filter items out of the array with the Configurable Collection Filter, or loop through the array with a For Each Item in Collection.  Once you've manipulated the data, you could write it back out to a CSV file as described in the article above.

b) Yes, you can display the data in a grid.  Just figure out what data type the CSV data came in as (it's probably DynamicDataType or something similar).  You can right-click on a downstream component, click Browse Data, checkmark Show Type Name, and that will tell you what data type your CSV data is.  Then choose that data type on your grid, and choose to show an Array process variable, which will of course be your CSV array.  There are many videos on Connect and that cover these and other fundamental Workflow techniques.

Login to vote
Robert Lundsten's picture

Great answers. This will help me forward.


Login to vote
noodleNT's picture

The CSV I get has some extra data on the first 3 lines. Is there an easy way to just skip those lines?

Login to vote