Vrishchik
(Naveenkumar Shivaraju)
1
Hi All,
I need to select the some data from an excel as below:
There are 100 rows and 12 columns, I need to select the things as below:
1.How to fetch the first and last record from the excel(including header).
2. How to fetch the 50th row and 7th column from the excel.
Please help me to solve this.
@Palaniyappan
@ppr
@Yoichi
@Gokul001
@Rahul_Unnikrishnan
Yoichi
(Yoichi)
2
Hi,
First read table in the sheet as datatable using ReadRange activity (Let’s say dt)
DataRow of the first row
dt.AsEnumerable.First()
Some item of the first row
dt.AsEnumerable.First().item("ColumnName")
DataRow of the last row
dt.AsEnumerable.Last()
Some item of the first row
dt.AsEnumerable.Last().item("ColumnName")
How to fetch the 50th row and 7th column from the excel.
dt.Rows(48)(6)
Regards,
2 Likes
@Vrishchik
For fisrt record
Datatablevaraible.AsEnumerable.take(1).CopyToDataTable
Datatablevaraible.AsEnumerable.skip(datatbale.rows.count-1).take(1).CopyToDataTable
For second scenario use below expression
dt.rows(49)(“7thcolumnname”)
Gives the value
Cheers
1 Like
Yoichi
(Yoichi)
5
Hi,
As row of datatable is 0-based index. So if there is column header, excel row 2 is assigned 0th row of datatable, as the following.
If there is no header (read range without header), it will be 49.
Regards,
system
(system)
Closed
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.