Excel operation for auto increment column range in add column activity

instead of manually changing range of write range activity i want to auto increment it every time

like for example
initial range A1:A12 next i want B1:B12 next time C1:C12 and so on
any logic for increment column range

thanks advanced
cheers :smile:

Similar to the row count, you can declare a variable of type integer and increment it whenever required,

as you want the string as C or D, I mean the column C or D, you just need to convert the integer to string using

Convert.ToChar(64 + integer Value here)_

sorry no getting can you please elaborate ?

Give the range as
count = 1
str = “A”

and in the write range activity
str + “1:” + str + “12” which gives you A1:A12, so when the writing completes, increment the value of count by 1 like count = count + 1.

so when you convert count to character using ,

Convert.ToChar(64 + count), it will give you “B”, so the write range will be changed to B1:B12

should i write like this ? :point_up:

where should i write Convert.ToChar(64+Count) ?

hey any answer ?

I have a question, where you are looping to get the values to write in B column?
You are trying to write values in 12 rows in A and then move to B?

see i have a excel 1 in that i have data from A1 to A12 that data i want to append in excel 2 every time excel 1 consists of different data but the column range will be same and in another excel that is excel 2 i have to append data every time

like this

That what, as per the above suggestion, you can simply increment the value after each write in excel 2 and after reading the data in excel 1, convert the count value to string using assign activity like

string str = convert.tochar(64 + count).tostring

which will give you B or C and so on based on the number. so that you can pass the str value to write range activity. Hope this is clear

not working buddy can you tell me once entire flow like which activity and what should i write

Are you getting any error or the process is not working as expected?

I guess, you are looping like reading the excel file and again initialising the variable to A so that it is writing the value to A. Is this right?

not able to append value in next column B1:B12 and so on

Can you post the screenshot of how you are writing the values and building the string for str B?

Even the workflow is better

Main.xaml (16.7 KB)
ABC.xlsx (16.6 KB)
Destination.xlsx (102.7 KB)

this two excel that im using and above workflow

please help i stuck here

You are not providing anything in the write range @Mayur_Pawar which will write the values in A column everytime, and the workflow is erroring out while opening to modify it


i provided str+“1:”+str+“12” in write range
as you said

This is what we have in the workflow you sent @Mayur_Pawar


Main.xaml (16.7 KB)
ABC.xlsx (16.6 KB)
Destination.xlsx (104.4 KB)

see if is this working ?

@HareeshMR please help