How to copy name , number, email address from outlook Email and paste it in Excel

HI all,
I am able to extract email data to Excel, But the Body of the Email contains few info like name, Email Address, Number, help me to copy these info in Excel in seperate cell in same row

1 Like

Hi @Dimple

You can use string manipulation to extract those data or use can use regex for the same.

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

@Pratik_Wavhal can you please share how to do or the file

Hi @Dimple

Can you share the Email Body data format in Text File so that it will be easy to work on it .

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

Hi

This can be resolved @Dimple
Kindly clarify us with a sample mail body so that we could come up with a solution

Cheers

@Palaniyappan, @Pratik_Wavhal This is the sample email body

  • Email: example@domain.com
  • First Name: ABC
  • Last Name: XYZ
  • Job Title: Role
  • Phone Number: 000.000.0000

I need this to be stored in excel in same row with different cells

1 Like

Hi @Dimple

Is it the same format in your mail body.
Means i want to ask no extra spaces anywhere ??

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

@Pratik_Wavhal , Yes this is the same format

Perfect
If this format is same then these expressions would help you resolve this

-use set of assign activities to get the individual values and store them in their respective variables

Str_email = System.Text.RegularExpressions.Regex.Match(str_body.ToString,”(?<=Email:).*”)

Str_firstname = System.Text.RegularExpressions.Regex.Match(str_body.ToString,”(?<=First Name:).*”)

str_lastname = System.Text.RegularExpressions.Regex.Match(str_body.ToString,”(?<=Last Name:).*”)

Str_JobTitle = System.Text.RegularExpressions.Regex.Match(str_body.ToString,”(?<=Job Title:).*”)

Str_phoneNumber = System.Text.RegularExpressions.Regex.Match(str_body.ToString,”(?<=Phone Number:).*”)

Cheers @Dimple

1 Like

Hi @Dimple

Using Regex shown by @Palaniyappan will also work Definetly if the exact format you have shown is correct

Below is the another solution for the same using String Manipulation that will also give 100% correct output.

All the below things must be done using Assign activity.

Str_email = mailBodyVar.Substring(mailBodyVar.IndexOf(“Email:”)+“Email:”.Length).Trim.Split((" "c))(1)

Str_firstname = mailBodyVar.Substring(mailBodyVar.IndexOf(“First Name:”)+“First Name:”.Length).Trim.Split((" "c))(1)

Str_lastname = mailBodyVar.Substring(mailBodyVar.IndexOf(“Last Name:”)+“Last Name:”.Length).Trim.Split((" "c))(1)

Str_JobTitle = mailBodyVar.Substring(mailBodyVar.IndexOf(“Job Title:”)+“Job Title:”.Length).Trim.Split((" "c))(1)

Str_phoneNumber = mailBodyVar.Substring(mailBodyVar.IndexOf(“Phone Number:”)+“Phone Number:”.Length).Trim.Split((" "c))(1)

Mark as solution and like it :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer: