How to read particular data range using column index value?

Hello All,

In an excel sheet , i’m trying to read last 7 column details and store it in a datatable.
I got the lastcolumn index and lastcolumn index - 6 which give me startcolumn index range.

Now i want to read range between startcolumn index : lastcolumn index

I dont know how to use this index in read range activity, could someone please help me?

Hi,
I hope this will help you,

In read range Use

Excel.Sheet(“Sheet1”).Range(“StartIndex:LastIndex”) and store it in datatable

Thank you

It didnt work

Can you post your code here? It should look like this (if for example you want to read columns from F to N):

Excel.Sheet("Sheet1").Range("F:N")

@Anusuya_R
If you want to read generically without putting excel headers
then first thing is to get your headers by column index
use UiPath.Excel.Helpers.ExcelUtilities.ConvertColumnIndexToColumnLetter method as the following?

for example,

UiPath.Excel.Helpers.ExcelUtilities.ConvertColumnIndexToColumnLetter(34) 

returns AH. This input column number is R1C1 style index, so if you use 0-based index, you need to add 1.

img20211020-a

After getting headers through column index then use read range and give range through headers to it