Write Cell Workbook - cell does not exist

I’m trying to create a new column called “Estimated value” to a file with a data table. This column should contain a variable called “estimatedValue”. I’m using For Each rouw activity. This is my code:

And here is the content of the “Cell” field in the Write Cell workbook activity.

image

However, everytime I run the code, I get an error saying the cell doesn’t exist. How can I write the variable “estimatedValue” in the correspondet cell dinamically?

Hi @Cristiane_DSC,

Your cell field should be valid cell address like A1,A2, etc. Since you are trying to write in column G you can use this expression “G” + cstr(index+2) (index is your iteration count of the for loop). Index is 0 based so you add 1 and we add another 1 since G1 is your column name.

I’ve tried the expression you suggested, but I’m getting this error message:

Argument “Cell”: BC30110: ‘Index’ is a structure type and cannot be used as an expression.

image

Hi,

It’s necessary to define int32 type variable (Let&s say idx) and set it at Index property of ForEachRow activity.

Then try the following expression in Cell property.

"G"+(idx+2).ToString()

Regards,

1 Like

Hi,

Index should be an int32 variable. You have to declare that variable in the for each loop properties section, and then use that variable in the expression.

You can refer to @Yoichi 's screenshot.