I am trying to get last used row for specific column from Excel file. for me it is giving output as per entire data table last row.
As per my current Code it is giving me output as 9 as per A Column data. But I want to update Status in B Column after each transaction of A Column, So want to get last Used Row from B Column only.
You can make use of REframework with Datarows and then just update the transaction item in set transaction state. This would be more efficient.
Else
Read the excel to a datatable, using read range/ read range workbook
Use for each row in datatable activity
and update the CurrentRow(“Status”) = “Printed” // Any conditions using if
and finally write back the datatable to excel, using write range workbook
Try this,
lastUsedRow_B = dt_Input.AsEnumerable().Where(Function(row) Not String.IsNullOrWhiteSpace(row(“B”).ToString)).Count
Update this as per your dt & columns.This counts only the non-empty rows in column B of your DataTable and gives the correct last used row based on that column.
If helpful, mark as solution. Happy automation with UiPath
Hello,
Thanks for giving solution.
I have tried with this logic, but it gives me output as 1. ideally it should give 3, because 2nd is Last used row in B Column.
Tried below.
Input_DT.AsEnumerable().Where(Function(row) Not String.IsNullOrWhiteSpace(row(“Status”).ToString)).Count
Hello Ashok,
Congratulations for MVP award & Trophy…
Thanks for Suggestion. But I am not able to find Excel Process scope in my activities. even in Manage Packages also not able to get.
Can you please guide me on this.