Excel Regex Extract Date

Hello,

I have this Excel column as shown below. I need to extract only the date found at the end of it and paste it into a new column next to it:

Can someone help me please?
thanks!
UIPath_Excel_Scratch (1).xlsx (131.9 KB)

Hi @Yudhisteer_Chintaram1

Please try this Main.xaml (9.2 KB)

In Invoke Code

dt1.AsEnumerable().ToList().foreach(sub(row) row(“Date”) = System.Text.RegularExpressions.Regex.Matches(row(“INV Date / BL Date”).ToString,“\d{1,2}/\d{1,2}/\d{1,4}”,RegexOptions.RightToLeft)(0))

Pass you datatable as in/out argument

image

Use write range to check if values are correct

Thanks

3 Likes

@Yudhisteer_Chintaram1

  1. Read your data table using read range and iterate through for each row.
    2.inside for each row assign your row value,
    InvDate=row(0).Tostring
    3.Then assign Date= System.Text.RegularExpressions.Regex.Match(InvDate,“(0?[1-9]|1[0-2])//\d{2}”).ToString
    it will gives you date in this row.
    4.After that assign row(2)=Date
    5.And then outside the for each row use write range to write datatable.

image
image

1 Like

Simply Use Split(Split(readtext,“;”)(1).ToString," / ")(1).ToString.Trim

Note the two spaces around the / in [" / ")(1)]

That should give you the date

1 Like

Thanks everyone for the help!

Thanks for the help :slight_smile:

Hi @prasath_S ,
Can you help in this one please?

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