UiPath Read Date in Excel

Hi,
I need to get the Date Value in excel.
But i’m getting 43252 like that value.
Date value in excel 1/6/2018 i want to convert 01-JUN-2019.

I can’t get the actual excel date value.

Thanks In Advance
Muthu M

Fine
to get this value 01-JUN-2019
kindly use this method
out_value = Datetime.ParseExact(row(“yourcolumnname”).ToString.SubString(0,10),“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“dd-MMM-yyyy”)

where out_value is a variable of type string

hope this would help you
Cheers @muthu.m

hello @muthu.m

while reading the excel enable PreserveFormat property.

image

Regards
Ajay

2 Likes

When i’m trying to get the value
DataDT.Rows(2)(1).ToString @Ajju as per your advice i did the changes.
but i get “[$-148432529]d mmmm yyyy”

@muthu.m
if possible can you share the workbook here

1 Like

@muthu.m share the file if possible because i will give a try to get the data in the same format

Kindly share a sample excel and your workflow all together in a zipped folder if possible
Cheers @muthu.m

Sample.xlsx (11.6 KB)

I need the value B4 & D4 then B6 & D6 @Ajju

I just want to get the date value in 01-JUN-2018 this format.

Thanks in Advance

here you go
hope this would help you
datetime.zip (10.7 KB)

Cheers @muthu.m

2 Likes

@muthu.m

the below might help you

Read.zip (10.2 KB)

1 Like

@muthu.m

The Below Sequnce is help you .Please check the sequnce.
I was took columns with columnIdex
ExcelManipulations.xaml (8.0 KB)

1 Like

Thanks to all @Ajju @Palaniyappan @pradeepRPA

1 Like

Cheers @muthu.m

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.

I opened your guys examples and I don’t think they provide sufficient answer on what to do if excel returns “43252 like that value.”,

The strange number is date in Serial format (this way Excel stores data).

You can use this function (also works with DateTime) where the number in brackets is the number you are getting from Excel (in case in Excel the type of field is Date/DateTime) (it can have decimals but it does not have to), as result you get Date or DateTime variable from which you can extract date in any format convenient for you.


Date.FromOADate(44650.6246278241).ToString(“mm-dd-yyyy”)

Replace the number with the number you are getting from Excel
Replace the “mm-dd-yyyy” with your desired date /+ time format, see more here:
Custom date and time format strings | Microsoft Learn

6 Likes

Thank you @Roman_hruska. I have been dealing with this for a long time without figuring out a solution. I wish I knew this YEARS ago :smiley:

2 Likes

Thank you so much for your solution…Its working only using Excel Application Scope. But not in Workbook Read range. y