How to append variable values in a column in excel

hello ,
I have extracted the Column 1 values using for each row in a var1. after applying apply some conditions I have the updated values of column 1 in the variable 2.
How to add the values of variable 2 one by one in the column 2?
pls help!

Hi @Karan28,

If you want to write the values to column2 of excel directly, use write cell activity with dynamic range as in the screenshot…

image

Where count provides you the row number and appending to the “A” can make it as a dynamic range. You can change that to whatever column you want to write the value. i.e., “B”

2 Likes

Hello ,
I created the count Integer variable with the default value 0 , but the count is not incresing and the and all the values are pending in the same cell only rather than incrementing by 1

Make sure you have assigned the value with 1 in the variables pane

And the assign activity will be above the write range as we need to write the value from second row onwards. If you are doing the same, attach the workflow or some screenshots

Here the counter is incremented by one only upto 2 ,means the values are appending in C1 and C2 only

the default value of counter is 1

what is the datatype of var2 buddy
Cheers @Karan28

which var2?

You are writing the value in a loop right?

How you are trying to get the values modify them and writing it back?

If your excel is not confidential, attach the workflow along with the excel, I will try to figure out the issue

this one


Cheers @Karan28

var1 is the output of get row item , its of generic variable type

variable 2 is type string

Fine
then we can simply mention like this in for each row loop
–use for each row loop and pass the datatable variable as input
–hope you got a variable2 of type string
–use a assign activity to pass the value of variable2 to each row one by one in the column you want
row("Column2name) = varaible2.ToString
Then we can use a write range activity next to this for each row loop that could write on to a excel

Cheers @Karan28

haressh ur above solution will work , there is a slight mistake i guess

Where you have Initialized the variable?
Within the variables pane or in the assign activity?

Yes, may be the issue is with the counter variable and the value increment. Recheck the entire flow once :slight_smile:

yes sure I will let you know

write range activity will write the value in column?

I created the variable in the variables pane.

And initialize it in the variables pane itself