How to extract specific content in email subject and body

Hi All.

I’m fairly new in automation using UIpath. Can anyone help me extract specific content in the email subject and body. I was able to get as far as extracting the entire email subject and body using assign activity (see below screenshot) but I don’t need the entire information just the required information below for my automation.

screenshot

Email Subject:
[EXTERNAL] Company Business Point ABC Request - ACCOUNT NAME: XYZ1235678-2020 DORAVILLE GA TRM COMPANY - 10101010

Needed Data:
ACCOUNT NUMBER = 1235678
ACCOUNT TYPE = XYZ
PLANT INFORMATION = 2020 DORAVILLE GA TRM COMPANY
PRODUCT TYPE = 10101010

Email Body:
"Request for Product Override (GPO)

Allocation Period: Daily
Volume Basis: 8,390
Allocation %: 150
Volume Start Amount: 12,585
Volume Lifted: 14,702
Daily Volume Remaining: -2,117
Refresh: 9/28/2018 12:00:00 AM CDT

Allocation Period: Weekly
Volume Basis: 58,730
Allocation %: 110
Volume Start Amount: 64,603
Volume Lifted: 14,702
Weekly Volume Remaining: 49,901
Refresh: 10/4/2018 12:00:00 AM CDT

Allocation Period: Monthly
Volume Basis: 251,698
Allocation %: 105
Volume Start Amount: 264,282.9
Volume Lifted: 224,002
Monthly Volume Remaining: 40,280.9
Refresh: 10/1/2018 12:00:00 AM CDT

Existing GPO Approved: 7,500
New Requested Amount: 10,000
Total Active GPO: 17,500
GPO Lifted Amount:
GPO Remaining Amount: 17,500

Request Expiration Date: 9/27/2018 11:59:00 PM CDT
Requester Phone: 83939383
Requester Email: abc@xyz.com
Requester Comments:

Consignee/Consignee Group: ACCOUNT NAME: XYZ1235678
Terminal/Terminal Group: 2020 DORAVILLE GA TRM COMPANY
Product/Product Group: 10101010

Needed Data:
Allocation % = 150 (Daily)
Existing GPO Approved = 7,500
New Requested Amount = 10,000
Requester Email: abc@xyz.com

1 Like

You can use string functions.
Run attached and you can see your results. extractDatafromEmail.xaml (9.1 KB)

Hi Nadim,

Question, in your solution you will need to know before hand in which line of the mail the information you are looking for will be. What if I don’t know that? So in my case, I just want to retrieve, for instance, the name. Which is in the email body like this:

Name: Anniek
Adres: home
Company: UiPath

I don’t know how many line above or below this information will be, I just want to retrieve the information behind ‘Name:’, or behine ‘Company:’. Would you know how to do this?

Thanks in advance!

Kind regards!

I that case once you do a split by newline you can look for the index of array item with Name and then you can split that using : and get the name address and company

2 Likes

That worked, thanks! :slight_smile:

1 Like