How can we check the excel data range

Hi @ All,

I have one excel file .It contains one column,Here how can we check the count

Hi @varunk,

Use read range activity to get the data to datatable.(Dt)

Dt.rows.count → you can get the count.

Regards,
Arivu

Hi @arivu96

In excel we have more than 26 columns then how can we get the count

Hi @varunk,

To get column count use this one
intcount=Dt.Columns.count
To get rows count use this one
intcount=Dt.rows.count

Regards,
Arivu

Hi @ arivu96

kk.
How can we find the index value of particular row,I mean what is the starting row and ending row.
To get the index value

@varunk

If all your columns contains same values then you can use for each row to get the index easily, If the elements count is different for different columns means then you have to extract the columns seperately and you have to get the last element count.

Regards,
Mahesh

I have excel file contains two rows.
In that two rows contains 6 numbers{6 rows}.My question is that I need output is index value starting row is A2 & ending row is A5.

@varunk
can you share your excel for better understanding.

Regards,
Mahesh

Sample.xlsx (8.6 KB)

this is my excel

@varunk
First read the excel sheet and store it in datatable dt by using read range activity, and check add headers property in read range activity.

  1. Always the index of first row will be zero.
    2.If you want the last index will be (Dt.Rows.Count-1)
    3.If you want the index of row containing particular element use this query
    (From p in dt.Select()
    where Convert.Tostring(p.Item(“Numbers”)).Equals(“4”)
    Select Convert.ToString(dt.Rows.IndexOf(p))).To List()

4.In place of 4 you can change what ever element you require.
5.The list will contain the indexes of the given value.

Regards,
Mahesh