web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Extracting text from b...
Power Automate
Unanswered

Extracting text from body of email

(0) ShareShare
ReportReport
Posted on by 6

Hello, a supplier sends me an email with a certain rate that i need to grab. I need to extract a specific number in an email that contains a number with two decimals. This number is not fixed, e.g.

 

10,92% -> 10,92 should be extracted, only the number is each time different. Only a comma (,) is always available. 

 

Then it needs to write this number to a text file which i will later use in an excel file (not needed in power automate and send an email with this number to my mail account.

 

I suspect this needs to be done in a condition, like 

contains(outputs('Html_to_text')?['body'],'XX,XX%') but i do not know how to state it in working code. Any suggestions?
Categories:
I have the same question (0)
  • rzaneti Profile Picture
    4,260 Super User 2025 Season 2 on at

    Hi @TomV28 ,

     

    You will need some text expressions to achieve it. I will be glad to help you, but first I have some questions about the email template from where you will extract the number:

    • Does it follow a default template, or the number can be anywhere in the email body?
    • Is it possible to have another "%" character in the email body?
    • Will you have the decimal points even if the % is an entire number? (e.g.: for 12%, would it be represented as 12,00% in the email?)

     

    If this is a default email template, please provide us with a sample image/text of that (make sure to remove any sensitive content before sharing it).

     

    Also, I'm sharing an article that I recently wrote about how to extract texts in Power Automate, which can be useful for a better understanding on the available text functions: http://digitalmill.net/2023/08/12/how-to-extract-and-clean-texts-with-power-automate/ 

  • TomV28 Profile Picture
    6 on at

    Hi, thanks for your quick reply. 

    Yes, the number can be anywhere in the body. It is just a plain email concerning a simple text like 'Hi, the current rate is 17,47%' So it is always a number e.g. 11,00% (with always percent character).

     

    It is difficult to understand how to create this code while the percentage can be any number but with always know that there are two characters left and right of the comma and with a percentage sign after the number, e.g. XX,XX%

    See attachment screenshot email.

     

  • v-yetonggu-msft Profile Picture
    on at

    Hi @TomV28 ,

    I'm assuming that you only have a percentage string with '%' in your email body.

    If so,I did a test for your reference.

    In my scenario:

    vyetonggumsft_0-1709090942396.png

     

    substring(outputs('Html_to_text')?['body'],sub(indexOf(outputs('Html_to_text')?['body'],'%'),5),6)

     

    vyetonggumsft_1-1709090987282.png

    Best Regards,

    Sunshine Gu

  • TomV28 Profile Picture
    6 on at

    Hi, thanks for the example,

     

    I tried your approach, removed condition and replaced with your compose script (see image) and have the flow send an email back to me if it succeeds. It does send me an email back whether there is a number in it or not. What am i doing wrong?

  • TomV28 Profile Picture
    6 on at

    Hi, thanks a bunch, very interesting but i have absolutely no idea how to implement this into my flow. can you provide me an example e.g. if a number like 10% in an email arrives from email address X it writes a text file with this percentage and sends me an email when it is succeeded?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard