How to find out the column index of excel if I have Column name

Hi,

I am using Write cell activity to write value in excel. I have Column Name, but the column may change to different place. Eg: The Column1 may in Column A or Column B in excel.
I have used the below code to get the Range of the cell with Column Name. But this is working till “Z”. From “AA” it is not returning correct index.

Convert.ToChar(65+DTTest.Columns.IndexOf(“Column Name”))

So, how to get the Range till end of the excel. Eg: How to get Range “AB1” by Column Name - “Home”

image

1 Like

@vigneshnkv,

Check this snippets, it will convert the number you passed into the excel column name.

ConvertToLetter.xaml (9.2 KB)

2 Likes

kindly have a view on this thread
this could add some insights on this kind

Cheers @vigneshnkv

hi how can i read a column with its header name…my column postiton is not fixed…i want to read a particular cell/column and locate with its name everytime i want it…i gave column name in cell but its throwing error

1 Like

hi how can i read a column with its header name…my column postiton is not fixed…i want to read a particular cell/column and locate with its name everytime i want it…i gave column name in cell but its throwing error

Hi
Welcome to uipath community

If we know the cell position we can get the column name
I would like to have it bit more elaborative on the process so that I could help on further steps

Cheers @user_1234

Thank you
I basically have two columns in my excel sheet and want to add values of both columns and show it in the third column. Now i cant do this directly using cell numbers in range i have to use column header say number 1 and number 2 to perform all the activities in uipath so that in future if the position of column changes i can still add it using headers… please if you could help

https://stackoverflow.com/questions/63583563/how-can-i-add-two-columns-in-an-excel-sheet-using-the-column-name-instead-of-giv there is full detailed solution for you.