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: https://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 - https://andersjensen.org/email-newsle...
📷 Instagram - / andersjensenorg
#uipath #rpa #automation