Showing results for 
Search instead for 
Did you mean: 
Level: Powered On

Extracting Text from email without knowing its length?



Many thanks to all those that post up questions and answers, just by searching this board I have been able to find a ton of solutions and inspirations!!

I found a great thread that has helped me create a flow to extract some text values from an email.

My Flow first converts the email to plain text using "HTML to text"


For example my incoming email contains;


Ticket ID# 8371     


The function I'm using in Flow is

substring(body('Html_to_text'),add(lastIndexOf(body('Html_to_text'),'Ticket ID#'), 11),7)


The return is



Later that chunk of text gets put in to a column in and Excel sheet hosted on Sharepoint.

OK, so all is well so far and I'm using the same function for other bites of data and I just modify my label along with the character counts.


My Challenge;

Its real easy for terms like Ticket ID, or Location cause I know what the max value will be.

I'm jammed on how to deal with other bites of data that could be only 10 characters in length, or it could also reach 500.


For example 

Ticket ID# cause in some of my fields it could just be a simple 4-6 letter or someone could type out something much longer


I'm super n00b at using these expressions, but hoping someone could give me an example to work with.

I have full control of the incoming email, so my first instinct is that it would be great to somehow identify an opening and a closing "gate/bracket/iD"--- not sure what to call it, but basically a means to book end my data bites.


something like just capture the text you see in between; 

 Ticket ID#<start> 8371 <end> 


hope this all makes sense!!


Accepted Solutions
Level: Powered On

Re: Extracting Text from email without knowing its length?

Community Support Team
Community Support Team

Re: Extracting Text from email without knowing its length?

Hi @chico,


If possible, please consider using Parser to turn incoming emails into useful data then use the returned values in your next actions.

Please check this blog for more deteails:



Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Level: Powered On

Re: Extracting Text from email without knowing its length?

yeah Parser and other services are cool but I'm not allowed to send emails outside of our internal network to a third party.

Plus, it would just be an extra cost and we have no money.....

Level: Powered On

Re: Extracting Text from email without knowing its length?

Helpful resources


Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!


Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!


New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!


Power Automate Community User Group Member Badge

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


Power Platform World Tour

Find out where you can attend!


Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (6,074)