How Can I read excel row 9 to wherever the last row which has data in it. EX: C9 to C123 . How Can I get that number or just read those rows from row 3 or 4 or 5.
Read Range activity without range specified will give you datatable with all data.
You can get the last row from datatable.RowCount.
Then you can use Read Range activity again this time with range specified (eg. “C9:C123”).
You can also use “Lookup Range” or “Lookup Datatable” to find a specific cell.
Hey @Pal_Patel
Just use Read Range activity without the range specified you will get whole data in datatable variable, then take a assign activity:
dt_Output = dt_Input.AsEnumerable().Reverse.Take(1).CopyToDatatable
OR
dt_Output = dt_Input.AsEnumerable().TakeLast(1).CopyToDatatable
Note: dt_Output is Datatable variable, and dt_Input is Read Range activity variable.
by using above LinQ will get last row of the excel in dt_Output data table variable!
Hope this resolves your query!
Happy Automation!
Regards,
Ajay Mishra
- Read the entire excel sheet & save output in DT variable
- In assign activity use rowscount=DT.rows.count
- In read range activty, give range C9:C+rowscount.ToString
4.In output of above activity you will get your desired range.
@Pal_Patel Please send a Screenshot of the Excel sheet or dummy Input and output.
Regards,
Ajay Mishra