Write cell / rowindex not working

Hi, I would like to add a new column(E) and If the line is correct then add ‘True’ value for that row in the new column. Any suggestions how I may go about doing it?

This is a sample of how my excel looks like:

Thank you xoxo

1 Like

Hi @sangasangasanga

You can simply use add data column activity .What else you need to do?

@Sob Oh I see, I didn’t know about add date column activity till now.

Expected Outcome:

you can use add data coloumn activity and define a variable as data row type that will loop the rows n check the rows data and whereever you condition got satisfied there you can supply the value as true using the assign activity


You need to compare the D column values .?
means if it is ‘0’.you have to mention “false” right?

I got the comparison part. What I am trying to ask is …
I am using an if condition for condition part. IF it is true. then use assign activity. What to write in assign activity so that the true value goes to that row and e new column example. (E2)


1.read your excel file and store it in the dataTable
2.Use For each row. Inside the for each row , use If condition.
3.If row(3)<>“” ,then it will come to the then part .and again use if condition (if row(3)<>“0”)
4.In the then part assign your values

Hi, how to assign the value to the last column of the row?

After reading your input file .add “add data column activity” before for each loop.

here columnName is test.

so In the assign activity row('test")="true


Check the condition what ever it is and on the base of that condition make the activity of write cell in True and False

For example :


@Rashmi Hi, your solution seems to work but however it is not on the row that I am checking. I was checking A2 so supposed to write on E2 but it is writing on E1

@Sob Hi, I tried but it’s not working. Not sure why

Before assigning your values .give if row(3)<>“” //not equal to empty .
Then use assign activity.

Assign rowIndex = DtataTable.Rows.IndexOf(row) + 2 and run it again

@Sob @Rashmi
Hi, not sure if your solutions are dynamic enough.

This is what is happening:
Open up excel file. Read Range. IF this line exists. ASSIGN dt,selects(line).copttodatatable. For each row, rowIndex ASSIGN row.tostring Assign getCost Assign. Open up excel file to compare price to. read range. Assign dt1.select(line).copytodatatable. For each row, get cost Assign. If prices same, write cell.

Expected: Basically, for the line if it exists, I would like to add value to column E in that excel file.

@Rashmi After i +2. it asks me to change rowIndex variable type to Int. Then, in the write cell part, “E” +rowindex.tostring. But it doesn’t work

@Sob Not sure why, but your suggestio isn’t working for me

@Rashmi Hi, yours seems working but however the condition if there is a particular line then write true for that particular row E cell, instead of writing for that particular cell it writes for all.

Can you please change the scope of rowindex and try again.