cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jrivera1
Level: Power Up

Re: Extract text from Body of an email in Flow

Good morning, I need help extracting text from the body of an email in Flow and populate fields in SharePoint.  The data we need is the Agent's Name.  We are currently using Flow to generate request tickets in SharePoint.  can anyone help with this?  An extract of the email is below:

 

Agent's Name: Donna Keena

Date of Request: 06/11/2019

Property Address: 17 Park Street, BELLEVILLE, NJ 07109 US

Type of Property: House

Underground hazards present: None Known

If Yes, Type of hazard?:

Sign Type: Sign Panel Only (No Post)

Location to Install Sign: See Special Instructions

Special Instructions: Please remove sign post.

(Sent via Special Properties Christie's)

venseben
Level: Powered On

Re: Extract text from Body of an email in Flow

Hi @Jrivera1 I have had the same challenge and managed it bu using Flow in this way:

I created a flow where i used the HTML to text action, and took the content of the mailbody in there. Then i created an expression like this:

 

substring(body('html_to_text'),add(lastIndexOf(body('html_to_text'),'Link:'),32),4)

 

I needed a link in the mail, and knew taht it always after the word "Link". The it was just a matter of counting (32 and 4) and voila, i got the link i needed. I think this is nearly the same. Make the expression return anything between "Agents name" and "Date of Request" and i think you can get what you need.

 

/Frank

MarekZ
Level: Power Up

Re: Extract text from Body of an email in Flow

Hi, i use this for extract specyfic text line from body of email and it works,



  substring(body('html_to_text'),add(lastIndexOf(body('html_to_text'),'monitorowania:'),15),20)

 

But i also have a problem. Text has random lenght from 10 to 20 letters.

How cut it on first blank space after text that i extracting?

Ronny
Level: Powered On

Re: Extract text from Body of an email in Flow

U can use the (indexOf(the text after extract text)-indexOf(extract text)) as your lenght in the substing function
MarekZ1
Level: Power Up

Re: Extract text from Body of an email in Flow

You mean something like this?

 

substring(body('html_to_text'),add(lastIndexOf(body('html_to_text'),'monitorowania:'),15), (indexOf(‘ Plan’)-indexOf(lastIndexOf(body('html_to_text'),'monitorowania:'),15)))

 

if i want extract

 

UE878389107YP

 

from this

 

monitorowania: UE878389107YP 
Plan

 

 

Im beginner and learn myself when i see real working samples ☹

MarekZ1
Level: Power Up

Re: Extract text from Body of an email in Flow

working

last(split(first(split(body('html_to_text'),'test2')),'test1'))

 extract 2345 where string is 'test12345test2'

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,072)