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!