How can we check the excel data range


#1

Hi @ All,

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


#2

Hi @varunk,

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

Dt.rows.count-> you can get the count.

Regards,
Arivu


#3

Hi @arivu96

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


#4

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


#5

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


#6

@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


#7

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.


#8

@varunk
can you share your excel for better understanding.

Regards,
Mahesh


#9

Sample.xlsx (8.6 KB)

this is my excel


#10

@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§)).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