Remove Data Row/Column
The example below explains how to remove rows and columns from a DataTable by using the Remove Data Column, Remove Data Row, For Each Row in Data Table, and Get Row Item activities. You can find these activities in the package.
This is how the automation process can be built:
-
Open Studio and create a new Process.
-
Drag a Sequence container in the Workflow Designer.
-
Create the following variables:
Variable Name Variable Type Default Value DT1DataTable RemovedRowsList<DataRow> new List(of DataRow) StringDTString noteAdd your
.xlsxfiles to the project directory in order to be able to run the entire process from the same place.
-
-
Drag a Read CSV activity inside the Sequence container.
- In the Properties panel, add the expression
"challenge.csv"in the FilePath field. - Select the Comma option from the Delimiter drop-down list.
- Select the check box for the IncludeColumnNames option.
- Add the variable
DT1in the DataTable field.
- In the Properties panel, add the expression
-
Place a Remove Data Column activity below the Read CSV activity.
- In the Properties panel, add the expression
"Phone Number"in the ColumnName field. - Add the variable
DT1in the DataTable field.
- In the Properties panel, add the expression
-
Drag a For Each Row activity below the Remove Data Column activity.
- Add the variable
DT1in the DataTable field.
- Add the variable
-
Select the Body container of the For Each Row activity and create the following variables:
Variable Name Variable Type Default Value AddressGenericValue AddressNumberInt32 -
Place a Get Row Item activity inside the Body container.
- In the Properties panel, add the expression
"Address"in the ColumnName field. - Add the value
rowin the Row field. - Add the variable
Addressin the Value field.
- In the Properties panel, add the expression
-
Drag an Assign activity underneath the Get Row Item activity.
- Add the variable
AddressNumberin the To field. - Add the expression
CInt(Address.Split(" "c)(0))in the Value field.
- Add the variable
-
Add an If activity below the Assign activity.
- Add the expression
AddressNumber >= 10 And AddressNumber <= 50in the Condition field.
- Add the expression
-
Drag an Add to Collection activity in the Then field.
- In the Properties panel, add the variable
RemovedRowsin the Collection field. - Add the value
rowin the Item field. - Select the System.Data.DataRow option from the TypeArgument drop-down list.
- In the Properties panel, add the variable
-
Drag a For Each activity below the For Each Row activity.
- In the Properties panel, select the System.Data.DataRow option from the TypeArgument drop-down list.
- Add the variable
RemovedRowsin the Values field.
-
Place a Remove Data Row activity inside the Body of the For Each activity.
- In the Properties panel, add the variable
DT1in the DataTable field. - Add the value
rowin the Row field.
- In the Properties panel, add the variable
-
Drag an Output Data Table activity below the For Each activity.
- In the Properties panel, add the variable
DT1in the DataTable field. - Add the variable
StringDTin the Text field.
- In the Properties panel, add the variable
-
Add a Write Line activity under the Output Data Table activity.
- Add the variable
StringDTin the Text field.
- Add the variable
-
Run the process. The robot removes the specified fields from the provided table and prints the new DataTable in the Output panel.
-
This is how your workflow should look:

Here you can download an example.