How to pick latest date from Excel and storing the latest date in string variable using uipath

Hi Team,

I have one excel with 2 dates in same colomn. So I want to pick the latest date from.excel and string in string variable using UiPath.
Can any one help me to get the latest date from Excel and storing the date in String variable.

Thanks in advance .


can you provide an sample input so that we and provide you a solution


Hi @Shiva_Nikhil ,
Sure, input sheet


And also I want the index of latest date or I want latest date along invoice number which in column A.
Output wil be like this

  1. Latest date and index based on date index I am extracting the invoice number.
  2. Latest date and invoice number which is in same row of invoice number.

Please suggest any solution


dt=dt.AsEnumerable.OrderByDescending(Function(x) CDate(x(0).ToString)).CopyToDataTable

output=dt(0)(“ColumnName”).tostring gives you the recent date

Hi @Shiva_Nikhil ,
But we don’t know in which row the lastest date in Excel .

For example in my excel i have 10 rows data .so we need to pick the latest date from Excel.


by using the above query you will get the latest row in the first row only

we are sorting that column

or try with modern activities


Hi @Baby123

Read the Excel data into a DataTable, you can use the DataTable.Select method to sort the data by date.

dt = dt.Select(“”, “DateColumn DESC”).CopyToDataTable

Replace DateColumn with your column name.