UiPath Activities

The UiPath Activities Guide

Verify CSV files

The example below includes two automation processes. The first process identifies a value and appoints a status to it, while the second automation process incorporates the first one, analyses the data from one file, processes it and stores it into another file.
The main activities used are Read CSV, Write CSV and Append to CSV. You can find these activities in the UiPath.Excel.Activities package.

This is how the automation process can be built:

  1. Open Studio and create a new Process. The process is automatically named Main.
  2. Go to the New tab and select Sequence.
    • In the Name field write Process.
    • Select the same location as the one for the Main process.
    • Select Create.
  3. In the Workflow Designer, select the Process tab.
  4. Drag a Sequence activity to the Workflow Designer.
  5. Add an If activity inside the Sequence.
    • In the Properties panel, add in the Condition field the syntax io_TransactionItem("Phone Number").ToString.EndsWith("2").
    • Add two Assign activities, one for the Then field and another one for the Else field.
    • For the first Assign activity, placed in the Then field, configure the Properties as follows: add io_TransactionItem("Status") in the To field and "Failure" in the Value field.
    • For the second Assign activity, placed in the Else field of the If activity, configure the Properties as follows: add io_TransactionItem("Status") in the To field and "Success" in the Value field.

Important!

Go into the project folder and create two new folders named Input and Output. Inside the Input folder, add the .csv file from which the data is read.

  1. In the Workflow Designer, select the Main tab.
  2. Drag a Sequence from the Activities panel to the Workflow Designer.
    • Create the following variables:
Variable Name
Variable Type
Default

InputFile

String

"Input\ToBeProcessed.csv"

OutputFile

String

"Output\Results.csv"

ProcessDT

DataTable

-

  1. Add a Read CSV activity inside the Sequence
    • In the Properties panel, add the variable InputFile in the FilePath field.
    • Select the IncludeColumnNames check box. This specifies that the first row from your file contains the column names.
    • Add the ProcessDT variable in the DataTable field.
  2. Drag a For Each Row activity under the Read CSV activity.
    • In the Properties panel, add the ProcessDT variable in the DataTable field.
  3. Drag a Sequence in the body of the For Each Row activity.
  4. Add an Invoke Workflow File activity
    • In the Properties panel, add the file location of the workflow you want to invoke in the WorkflowFileName field. In this case, the path is "Process.xaml", as the file is in the project folder.
  5. Drag an If activity in the main sequence, below the For Each Row
    • Add in the Condition field the next syntax file.Exists(OutputFile).
  6. Drag two Append To CSV activities, one in the Then and one in the Else fields.
    • For both activities, set the FilePath as OutputFile and in the DataTable field add the variable ProcessDT.
  7. Run the process. Once the automation process is complete, you have a new .csv file in the Output folder, named Results.csv.

 
 
Download example

Updated 8 months ago


Verify CSV files


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.