UiPath: How to Extract Outlook Emails with Regex (Full Use Case)

Поделиться
HTML-код
  • Опубликовано: 27 июл 2024
  • This video tutorial shows how to extract data out of an Outlook Email Body in UiPath with the help of Regex. We go through each step of the use case in detail, so open your UiPath and create your own RPA workflow.
    📁 Download Course Materials: andersjensen.org/how-to-extra...
    👪 Join my UiPath Facebook group for additional lessons and to hang out with your highly skilled colleagues: / 1817369781750298
    0:00 Intro
    Today we are again through a very cool UiPath RPA use case, where we use Regex to extract data out of Outlook emails and print it into Excel. Regex is a sequence of characters that defines a search pattern, is mostly used on structured data, and is a must-learn for any RPA developer.
    1:37 Get Outlook Mail Messages and use a For Each
    Go to Activities and search for a "Get Outlook Mail Messages" activity. Make sure you specify the Account and Folder - especially useful when we want to move our automation between workstations. We save the emails to a list of MailMessages. We use a For Each. Here you need to remember to specify the TypeArgument to MailMessage. With the .Net properties mail.Date, mail.Subject and mail.Body we can easily extract the Date, the Subject, and the Body. With the .Net method string.contains we can check if our subject meets certain criteria.
    9:10 Save Outlook Emails to Excel
    We create a Data Table to save our output into. For each email, we use an Add Data Row and add an array of date, subject, and body. Finally, we save the Data Table into an Excel sheet.
    14:30 Extract data out of the email body with Regex
    We use Regex101 to create our Regular Expressions. Regex is a series of characters that defines a search pattern. It's something you need to learn as an RPA developer and is often asked in RPA interview interviews. To apply Regex in UiPath we use the Matches activity (where we define the pattern and save the output to an IEnumerable of Matches, which you can see as a list).
    24:15 Create a Dynamic Regex solution in UiPath
    We create a Data Table with a row for each Regex pattern, we want to use in our email extraction workflow in UiPath. Afterward, we can loop through each pattern one by one and extract each thing one by one.
    32:17 Move the processed emails
    We move our emails one by one after we've processed them. In addition, we create a unique Excel sheet every time the robot runs, so we don't overwrite it. A best practice to create unique file names is using the date and time in milliseconds, since this is unique.
    Connect with me:
    👥 Facebook - / andersjensenorg
    🎮 Discord - / discord
    💼 LinkedIn - / andersjensens
    💌 Email Newsletter - andersjensen.org/email-newsle...
    📷 Instagram - / andersjensenorg
    #uipath #rpa #automation
  • НаукаНаука

Комментарии • 84

  • @andersjensenorg
    @andersjensenorg  3 года назад +4

    If you like this video, then you will love the UiPath Document Understanding tutorial: ruclips.net/video/cp1hbChzUQ4/видео.html, where you'll learn how to use the Document Understanding package (invoice). Thanks for all your support 😊

  • @mishmicandappa9219
    @mishmicandappa9219 16 дней назад +2

    Thank You So much,This really helped

    • @andersjensenorg
      @andersjensenorg  12 дней назад

      I'm so glad to hear, thanks a lot. Kind regards, Anders

  • @ayodejiosikoya1354
    @ayodejiosikoya1354 3 года назад +1

    Wow, Saw this at the point when i needed this exact solution. Thank you for the effort.

    • @andersjensenorg
      @andersjensenorg  3 года назад

      Hey Ayodeji. Thanks a lot - I'm very happy, you could use it :) Kind regards, Anders

  • @supritpradhan6655
    @supritpradhan6655 3 года назад +1

    Great use case which covers couple of more concepts 👍

    • @andersjensenorg
      @andersjensenorg  3 года назад

      Hey Suprit. Thanks a lot for letting me know 🙂🙋🏻‍♂️🙏 Kind regards, Anders

  • @jakepaz7667
    @jakepaz7667 3 года назад +1

    This is an awesome tutorial. Thanks for sharing

    • @andersjensenorg
      @andersjensenorg  3 года назад

      Hey Jake. Thanks a lot. At the moment I'm taking care of my family, but I will be back with new videos from August the 15th. Kind regards, Anders

  • @joswadsouza9849
    @joswadsouza9849 3 года назад +1

    Once again awasome video thank you so much ❤️🔥 🙏

    • @andersjensenorg
      @andersjensenorg  3 года назад +1

      Thanks a ton, Joswa 🤩🤗🙋🏻‍♂️🙏 Kind regards, Anders

  • @krishnakanthsarma1014
    @krishnakanthsarma1014 3 года назад +1

    Hi Anders, Thank you so much for this tutorial am searching for this like a week

    • @andersjensenorg
      @andersjensenorg  3 года назад +1

      Hey Krishnakanth. Thanks a lot for your nice comment and I'm really happy to help you 🤓 Kind regards, Anders

    • @krishnakanthsarma1014
      @krishnakanthsarma1014 3 года назад

      @@andersjensenorg please conduct the live sessions about the documentation will join for sure thank you

  • @robotdream8355
    @robotdream8355 3 года назад +1

    Awesome Anders

    • @andersjensenorg
      @andersjensenorg  2 года назад

      You're very welcome, Robot Dream - your support helps me a lot 😍

  • @srushtikotangale2064
    @srushtikotangale2064 3 года назад

    Wow!!! Thank you so much. You're the bestest!!

    • @andersjensenorg
      @andersjensenorg  2 года назад

      You're very welcome, Srushti Kotangale - your support helps me a lot 😍

  • @MrMwenesi
    @MrMwenesi 2 года назад +1

    Hi Anders. Nice video. You should do a course on Regex. I learnt a lot from the little you gave us

    • @andersjensenorg
      @andersjensenorg  2 года назад

      Hey Henry. Thanks a lot. Just editing a video about RegEx in Power Automate (with the help of Office Scripts) 🙂 Kind regards, Anders

  • @maximilianreuss4006
    @maximilianreuss4006 3 года назад +1

    Thank you!!

    • @andersjensenorg
      @andersjensenorg  3 года назад

      Hey Maximillian. Thanks a lot 🙂🙏 Have a great day. Kind regards, Anders

  • @christianmarpert3844
    @christianmarpert3844 2 года назад +2

    Great explanation! I like your content! However, I prefer doin this kind of stuff in C# (invoke code). Just a few lines of code instead of an entire screen ;). Anyway, thks for sharing ! Keep goin!

    • @andersjensenorg
      @andersjensenorg  2 года назад +1

      Sure, Christian. But if you want to include it in a larger process, it might be faster than code. And hey, I'm not a coder, so it's difficult for me 😀

  • @iTzRUNN3R
    @iTzRUNN3R 5 месяцев назад +1

    Hi Anders! Great video! When making the matches segment and write line ienMatches(0).Value, how would you do it if your email contained an unknown number of Case ID's? For example the email you were working on. How would you extract and print out an unknown number of Case ID's if every email contained more than one. Could be 1 but could also be 20? How can i then make it so it saves all 20 Case ID's to the excel sheet?

    • @andersjensenorg
      @andersjensenorg  5 месяцев назад

      Thanks for writing 😊 I'm getting more than 50 messages daily. While I read all of them, I can’t reply to everyone 😔 But I’ve created an RPA/Automation community where we’re 11,000+ RPA Developers helping each other with solutions and our careers. Here’s the video on how to join (the invitation link is in the video description): ruclips.net/video/xWFz-S96XGo/видео.html Kind regards, Anders

  • @n.a.s1096
    @n.a.s1096 3 года назад +1

    Hi Anders, thank you for the tutorial. Do you have any ideas on how to remove signatures from the e-mail body? Seems hard to do with Regex.

    • @andersjensenorg
      @andersjensenorg  3 года назад +3

      Hey N.A. S. Thank you very much 🙂 We can use Regex. Find the signature using a Regex pattern. Then do a .replace. I'll gladly show you, can you post your (anonymized) email on either my FB or Discord? Then I can solve it so many can benefit 🙂 Kind regards, Anders

    • @robotdream8355
      @robotdream8355 3 года назад

      @@andersjensenorg undoubtedly one the best resource. What is your fb group link?

  • @trvelere
    @trvelere 3 года назад +1

    Great video! What does "ien" stand for in ienMatched(0) and why is it important?

    • @andersjensenorg
      @andersjensenorg  3 года назад

      Hey Andrzej. Great question. It's the best practice naming convention (camelCase like eBay). We start with a small letter, then we write something to indicate what variable type it is (e.g. ien for IEnumerable, str for String or int for Integer). The next word is a describing name and that starts with a capital letter. So basically "just" a name 🙂 But a naming convention I can recommend. Kind regards, Anders

  • @julieluo4837
    @julieluo4837 3 года назад +1

    Hi Anders, a very great tutorial.
    But I am kind of having difficulty to understanding on the following.
    dtOutput.rows(intIndex).item(row.item(“Name”).ToString) = ienMatches(0).Value
    May I know what is the “0” value is referring to in dtRegex? I guess is the column “Name” in the dtRegex, but not sure is it correct, please enlighten.
    Thanks :)

    • @andersjensenorg
      @andersjensenorg  3 года назад +1

      Hey Julie. Thanks a lot :) Yeah, sometimes it can be a bit complicated. The 0 simply just means, that we want the first match. It's zero-indexed so the first match can be referred to by 0, the second match by 1 and so on. Often there will only be one match (and there fore it's the first), but you will create some workflows with multiple matches, where you might want to refer to some other match than the first (or maybe all of them). I hope this helped you. Kind regards, Anders

    • @julieluo4837
      @julieluo4837 3 года назад

      @@andersjensenorg Thanks for the great explanation ;)

  • @10chil
    @10chil 2 года назад +1

    Hello Anders, I’ll watch your videos which mostly solve my issues but I’m trying to extract the table data from an email outlook with regex how can I do that. I tried with front end but it’s kind of a complex process so thought of using regex to extract table data.

    • @andersjensenorg
      @andersjensenorg  2 года назад +1

      Hey Susmitha
      Thanks for writing. I'm getting more than 40 questions/comments every day and having difficulty answering everyone (I try my best).
      I've created my UiPath Groups, where we all can post and solve problems or simply just hang out around our favorite tool, UiPath. So you're very welcome. Get the addresses here: ruclips.net/video/C6xmGfEL07I/видео.html
      Have a great day.
      Kind regards,
      Anders

  • @mjafrul
    @mjafrul 2 года назад

    Please create a video on "how we to write specific excel data table in outlook mail body using UiPath".

    • @andersjensenorg
      @andersjensenorg  2 года назад

      Hey Jafrul Hasan
      Thanks for writing. I'm getting more than 40 questions/comments every day and having difficulty answering everyone (I try my best).
      I've created my UiPath Groups, where we all can post and solve problems or hang out around our favorite tool, UiPath. So you're very welcome. Get the addresses here: ruclips.net/video/C6xmGfEL07I/видео.html
      Have a great day.
      Kind regards,
      Anders

  • @tiffanytu3118
    @tiffanytu3118 2 года назад

    Hi Ander, would you please help why the output to excel on the body column was blank only? Thanks

    • @andersjensenorg
      @andersjensenorg  2 года назад

      Hey Tiffany
      Thanks for writing. I'm getting more than 40 questions/comments every day and having difficulty answering everyone (I try my best).
      I've created my UiPath Groups, where we all can post and solve problems or hang out around our favorite tool, UiPath. So you're very welcome. Get the addresses here: ruclips.net/video/C6xmGfEL07I/видео.html
      Have a great day.
      Kind regards,
      Anders

  • @sandrabello-m3483
    @sandrabello-m3483 2 года назад +1

    Hello Anders, i like your video. I would like to question if with this method I could read messages not structured of Outlook for example to extract date, keywords of subject and also of body of every one this messsages answered, forward, received and finally to copy the data to excel spreadsheet. Best, regards.
    Message 1 date
    Body
    --------------------------------
    Message 2 date
    Body
    -----------------------------------
    Message 3 date
    Body

    • @andersjensenorg
      @andersjensenorg  2 года назад

      Hey Sandra Bello-M3
      Thanks for writing. I'm getting more than 40 questions/comments every day and having difficulty answering everyone (I try my best).
      I've created my UiPath Groups, where we all can post and solve problems or hang out around our favorite tool, UiPath. So you're very welcome. Get the addresses here: ruclips.net/video/C6xmGfEL07I/видео.html
      Have a great day.
      Kind regards,
      Anders

  • @Francotujk
    @Francotujk 3 года назад +1

    Hello Anders
    Please help me!
    I am automating web scraping.
    I have the following problem: the site opens a new tab automatically. UIpath can open the new tab, but it returns automatically to the initial page (so, I cannot make clicks, etc on the page opened). I used the command Ctrl + Tab, but didnt work.
    How can I solve this?

    • @andersjensenorg
      @andersjensenorg  3 года назад

      Hey JRR. What site? Kind regards, Anders Ps. Can you post the problem in my FB group: "UiPath RPA Professionals", then I solve it for you and others can benefit? Kind regards, Anders

  • @Mihirpatel2402
    @Mihirpatel2402 3 года назад +1

    Sir thank u for your solution but i cant extract from the body so can u plz help me ?

    • @andersjensenorg
      @andersjensenorg  3 года назад

      Hey MiHir. Thanks a lot 🙂 Unfortunately I don't have time for specific questions 1-to-1, but feel free to post the problem in the Facebook group (link is in the description), and we'll solve it. Kind regards, Anders

  • @dattaveeravalli2446
    @dattaveeravalli2446 2 года назад

    Great!! If there is keywords in mail then from that keywords you want raise ticket...can you please guide this.....

    • @andersjensenorg
      @andersjensenorg  Год назад

      Thanks for writing 😊 I'm getting more than 50 messages daily. While I read all of them, I can’t reply to everyone 😔 But I’ve created an RPA/Automation community where we’re 5800+ RPA Developers helping each other with solutions and our careers. Here’s the video on how to join (the invitation link is in the video description): ruclips.net/video/xWFz-S96XGo/видео.html Kind regards, Anders

  • @kirankumar-dt6rk
    @kirankumar-dt6rk 3 года назад +1

    Hello sir.. I've started watching your videos recently and would like you to suggest VB commands for uipath and also I want to retrieve the row wise data in Excel n copy that retrieved data into another excel file. Could you please suggest how to do this automation. Any kinda answers will be appreciated thank you..

    • @andersjensenorg
      @andersjensenorg  3 года назад +1

      Hey Kiran. Thanks a lot. Sure. Read both the Excel sheets into Data Tables and iterate through the first using a For Each Row. Then use a Add Data Row inside with the dtAnotherDataTable and in array {row.item("yourColumnNameInTheFirstExcel").ToString} Finally write it back to Excel. Let me know if you can solve it or feel free to post the question in my FB group "UiPath RPA Professionals". Kind regards, Anders

    • @kirankumar-dt6rk
      @kirankumar-dt6rk 3 года назад +1

      @@andersjensenorg Thanks alot sir.. Keep on doing tutorials on uipath.

    • @andersjensenorg
      @andersjensenorg  3 года назад +1

      @@kirankumar-dt6rk Will do :)

    • @kirankumar-dt6rk
      @kirankumar-dt6rk 3 года назад

      @@andersjensenorg Sorry sir, tried of it but, didn't get the desired result. Could you please do a clip for that. Actually, I'm a beginner who's been learning uipath since a month. Got this as assignment task.kind regards, kiran .

  • @user-qf3kj7mh5m
    @user-qf3kj7mh5m 3 года назад

    hi anderson , i tried this today but not getting expected results . I am getting a blank row after the headers , and my regex retrieved data is overwritten on the blank row

    • @andersjensenorg
      @andersjensenorg  3 года назад

      Hey RPA. Thanks for the question. At the moment, I’m on paternity leave, meaning I don’t produce videos and solve problems until the 26th of August. Feel free to post the problem at my Discord, where many bright automation minds are gathered: ruclips.net/channel/UCPdtz4gd_iYebJFYq9N8pWAcommunity?lb=UgxD1Qe9lWKL1I7HyAJ4AaABCQ Kind regards, Anders

  • @riyasharma6352
    @riyasharma6352 2 года назад

    Hi , i am getting error in assign activity that "object reference is not set to an instance of object"when try to assign dtResult.Rows(intIndex).Item(Rows.Item("Name").ToString
    Pls help me to resolve this issue....

    • @andersjensenorg
      @andersjensenorg  2 года назад

      Hey Riya Sharma
      Thanks for writing. I'm getting more than 40 questions/comments every day and having difficulty answering everyone (I try my best).
      I've created my UiPath Groups, where we all can post and solve problems or hang out around our favorite tool, UiPath. So you're very welcome. Get the addresses here: ruclips.net/video/C6xmGfEL07I/видео.html
      Have a great day.
      Kind regards,
      Anders

  • @osheenjose9703
    @osheenjose9703 3 года назад

    How to calculate age from DOB given in excel using uipath?

    • @andersjensenorg
      @andersjensenorg  3 года назад +1

      Hey Osheen. Thank you, I'll gladly solve it for you, but will be very complicated in a YT comment. Feel free to join this: ruclips.net/channel/UCPdtz4gd_iYebJFYq9N8pWAcommunity?lb=UgxD1Qe9lWKL1I7HyAJ4AaABCQ and post the question. Kind regards, Anders

  • @IPIX360
    @IPIX360 3 года назад

    In Assign, for this part:
    dtOutput.Rows(intIndex).Item(row.Item("Name").ToString)
    I'm getting error:
    Argument "To": Compiler error(s) encountered processing expression "dtOutput.Rows(intIndex).Item(row.Item("Name").ToString)". Option Strict On disallows implicit conversions from "String" to "integer".
    (Studio 2021 4.3)

    • @IPIX360
      @IPIX360 3 года назад +1

      My mistake: I've just forgot to make intIndex as Int32 in Variable Type. Problem solved.

    • @andersjensenorg
      @andersjensenorg  3 года назад

      Hey Gabriel. Thanks a lot for getting back. Kind regards, Anders

    • @IPIX360
      @IPIX360 3 года назад

      @@andersjensenorg ... this reply came from your robot! :)))

  • @SyedSAhmed3
    @SyedSAhmed3 Год назад

    Hi sir.. I need to click on all the links with yes from the Outlook email body but this yes no option won't be there on actual email and download all the files and merge all the data in one excel...

    • @andersjensenorg
      @andersjensenorg  Год назад

      Hey Syed Sultan Ahmed Thanks for writing. I'm getting more than 50 questions/comments every day and having difficulty answering everyone (I try my best). I've created my UiPath Groups, where we all can post and solve problems or hang out around our favorite tool, UiPath. So you're very welcome. Get the addresses here: ruclips.net/video/C6xmGfEL07I/видео.html Have a great day. Kind regards, Anders

    • @SyedSAhmed3
      @SyedSAhmed3 Год назад

      @@andersjensenorg thank u

  • @Nasrmsaleh
    @Nasrmsaleh 3 года назад

    please any good source to learn Regex?

    • @andersjensenorg
      @andersjensenorg  3 года назад +1

      Hey Nasr. If you mean in general and for the use in UiPath, I always recommend my students to check ruclips.net/p/PL4cUxeGkcC9g6m_6Sld9Q4jzqdqHd2HiD, which is by far the best. On several occasions, I wanted to make one myself, but I doubt I can do it better. Have a great day. Kind regards, Anders

  • @vishnupradhaban2189
    @vishnupradhaban2189 Год назад

    how to filter the outlook mail based on subject with condition of ignoring the case (filter the subject with specific subject - case insensitive)

    • @andersjensenorg
      @andersjensenorg  Год назад

      Thanks for writing 😊 I'm getting more than 50 messages daily. While I read all of them, I can’t reply to everyone 😔 But I’ve created an RPA/Automation community where we’re 4900+ RPA Developers helping each other with solutions and our careers. Here’s the video on how to join (the invitation link is in the video description): ruclips.net/video/xWFz-S96XGo/видео.html Kind regards, Anders

  • @warathanuts.1005
    @warathanuts.1005 2 года назад +1

    Is UiPath Studio free software?

    • @andersjensenorg
      @andersjensenorg  2 года назад

      Yes for individuals and small companies 🙂

  • @AS-vu4lh
    @AS-vu4lh 2 года назад

    Hi Anders,
    I have tried same concept in one of my scenario but it is failing will reading some number like "123-456-789-99" It will throw error like :- "exception has been thrown by the target of an invocation."
    CAn you suggest?

    • @andersjensenorg
      @andersjensenorg  2 года назад

      Hey A S
      Thanks for writing. I'm getting more than 40 questions/comments every day and having difficulty answering everyone (I try my best).
      I've created my UiPath Groups, where we all can post and solve problems or hang out around our favorite tool, UiPath. So you're very welcome. Get the addresses here: ruclips.net/video/C6xmGfEL07I/видео.html
      Have a great day.
      Kind regards,
      Anders