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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Issue extracting text ...
Power Automate
Answered

Issue extracting text for flow

(1) ShareShare
ReportReport
Posted on by 12
Hi,
 
I'm using a flow to trigger when an email is received from a certain account. 
 
It's a mail report and contains a few lines in the body but I'm only after part of one of them.
 
Report Id: 48aec5dd-f4fb-4c9a-9*******-*******
This email was automatically generated by the Generate Incident Report action.
Message Id: <************************************B11746.eurprd02.prod.outlook.com>
Sender: user1 name, user1@domain.co.uk
Recipients: user2@domain.co.uk
To: user2 name, user2@domain.co.uk
 
I want to extract the sender email address from this report and look it up against a Excel table. I have most of it working but the one issue I have is it extracting all of the sender, recipient and to details. so the lookup is failing. 
 
After the trigger I have a step to convert HTML to Text and after that 2 steps to extract the date. 
 
1st step is here 
first(
  split(
    split(body('HtmlToText'), 'Sender:')[1],
    '\n'
  )
)
2nd step 
toLower(
  trim(
    replace(
      replace(
        last(split(outputs('SenderLine'), ',')),
        decodeUriComponent('%C2%A0'),
        ''
      ),
      decodeUriComponent('%E2%80%8B'),
      ''
    )
  )
)
 
Can anyone advise where I've gone wrong?
 
Thanks
Categories:
I have the same question (0)
  • Verified answer
    rzaneti Profile Picture
    4,489 Super User 2026 Season 1 on at
     
    If I understood correctly, you want to extract the value "user1@domain.co.uk" from the email body. If this is the case, you can use the following expressions:
     
    Step 1 - split(split(body('Html_to_text'), 'Sender:')[1], decodeUriComponent('%0A'))[0]
     
    The decodeUriComponent is used to identify the line break in this context, instead of the '\n'. Based on the provided email body, the output of this expression will be:  Sender: user1 name, user1@domain.co.uk
     
     
    Step 2 - trim(split(outputs('SenderLine'), ',')[1])
     
    Here you're just taking the Step 1 outputs, splitting it by comma and accessing the second element. As an output, you will have user1@domain.co.uk
     
    Here is my test:
     
     
     
    I'm also sharing a blog about how to extract data from texts with Power Automate, which can be helpful for you or other users that find this thread in the future: https://digitalmill.net/2023/08/12/how-to-extract-and-clean-texts-with-power-automate/
     
     
    Let me know if it works for you or if you need any additional help!
     
    If this solved your issue, please mark it as Accepted Answer.
    👍 If it helped, feel free to give it a like!

    🌐 Explore more Power Platform content on my Website or on my ▶️ YouTube
    💼 Find me on LinkedIn
     
  • LH-12011614-0 Profile Picture
    12 on at
    @rzaneti This worked perfectly. 
     
    Thanks very much

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 541

#2
Valantis Profile Picture

Valantis 479

#3
Vish WR Profile Picture

Vish WR 470

Last 30 days Overall leaderboard