Baby123
(Baby)
September 29, 2023, 12:42pm
1
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 .
Regards,
Baby
@Baby123
can you provide an sample input so that we and provide you a solution
cheers
Baby123
(Baby)
September 29, 2023, 12:48pm
3
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
Latest date and index based on date index I am extracting the invoice number.
Latest date and invoice number which is in same row of invoice number.
Please suggest any solution
@Baby123
dt=dt.AsEnumerable.OrderByDescending(Function(x) CDate(x(0).ToString)).CopyToDataTable
use
output=dt(0)(“ColumnName”).tostring gives you the recent date
Baby123
(Baby)
September 29, 2023, 1:05pm
5
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.
@Baby123
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
cheers
Nitya1
(Nitya Tomar)
September 29, 2023, 1:53pm
7
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.
Thanks!!