Add data row cell to a column


I have 6 columns where 5 of them are always populated.
The 6th column cell needs to get a value added to it based on a condition.

How do I add a cell value to the 6th column?

Do I need to use add data row activity and how?

Hi @atomic u can use write cell activitiy.

Let’s say u want to add in C Column based on some condition.

While using for each loop there is a index varaible which stores the iteration of each row.

So after applying condition

U can use write cell activitiy with cell as

“C”+ (index+2). ToString


another way is use assign activitiy

row(columnName)= Value

After the loop is over use the write range to write the datatable.

Try these 2 ways

Hope the idea helps you

Mark it as solution if it resolves ur query


Nived N :robot:

Happy Automation

Hi thanks,

My datatable is already initiated. I am using REF and every transaction is added 1 by 1 one to the datatable.

Is there a way to use assign activity to add a cell to a specific column directly?

datatable.columns(“column name”) = “String value”

I think u can use write cell activitiy

Like this

Cell : “C”+ (transactionnumber+1).ToString if transaction Number starts from one .

As you mentioned in senario that you already created 6 column so better to use write cell activity to write data with respect of given condition

MyDatatable.Rows(5)(“Column Name”) = “String value”

Getting this error: There is no row at position 5.

I am thinking wrong :frowning:

I just want to add a value to columns 6 cell.
And its to the current row I am at.

Im confused.

Edit: I see the problem, “Rows(5)” is searching for the row. I just want to add the “String Value” at the current row. Do I need to add a counter or is there just some expression that adds a value to the last row.

I came up with a solution.

currentRow = MyDatatable.rows.count


MyDatatable.rows(currentRow - 1)(“Column6”) = “String Value”

1 Like