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 / Using a flow to extrac...
Power Automate
Unanswered

Using a flow to extract email body details

(2) ShareShare
ReportReport
Posted on by 50

Hello, 

 

Is there a way to leverage a flow to pull out email body and subject details without using a third party service? I'm looking to move details from an email into a sharepoint list.

 

Thank you

Categories:
I have the same question (0)
  • Verified answer
    v-yamao-msft Profile Picture
    on at

    Hi @Willo,

     

    Yes, it could be achieved by using WDL function in flow.

     

    Say your email body would be always the following format:

    1.PNG

     

    Then you could create a flow likes below. In this case, I will show how to extract the subject from the email body, please take it for a reference.

     

    The flow is triggered by When a new email arrives, then convert the email body from Html to text.

     

    In action Compose, use the code to get the total length of the body:

    length(body('Html_to_text'))

    In Compose2, use the following code:

    add(indexOf(body('Html_to_text'),'Subject'),9)

    In compose3, use the following code:

    indexOf(body('Html_to_text'),'Start time')

    In Compose4, use the following code:

    substring(body('Html_to_text'),outputs('Compose_2'),sub(outputs('Compose_3'),outputs('Compose_2')))

     

    It works fine and the subject can be extracted from the email body successfully.

    2.PNG3.PNG

     

    More details about the functions at here:

    https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference

     

     

    Best regards,

    Mabel Mao

  • GabrielStJohn Profile Picture
    on at

    Hello, @Willo!

     

    Thank you for posting on the Flow Community Forum! Have you had an opportunity to apply @v-yamao-msft‘s recommendation to adapt your Flow? If yes, and you find that solution to be satisfactory, please go ahead and click “Accept as Solution” so that this thread will be marked for other users to easily identify!


    Thank you for being an active member of the Flow Community!

     

    -Gabriel
    Flow Community Manager

  • Robert-RWEUK Profile Picture
    8 on at

    Could you explain how you then create the list itemfrom the extracted text items?  This was the OP's original aim, and we have a similar problem.

     

    Regards

  • BBAAK Profile Picture
    2 on at

    I was able to do this by making sure I had a connection for SharePoint online in my connectors.

     

    Then I selected after "compose 4", Create Item for SharePoint, then by putting in the address of the site in SharePoint online, then selecting the list,

     

    Then used the dynamic content selector to get the output for Compose 4

     

     

    Annotation 2019-10-15 163540.png

     

  • dee2005 Profile Picture
    95 on at

    Hi @v-yamao-msft ,

     

    I know this is quite an old post but i hope you will be able to help. Could you explain each of the various compose steps? I'm especially curios why you have a 9 in compose 2?

     

    Seeing this is quite old is there any new and better ways to do this without a third party services of course.

  • mmangiante Profile Picture
    304 on at

    Hi @dee2005 

     


    @dee2005 wrote:

    Hi @v-yamao-msft ,

     

    I know this is quite an old post but i hope you will be able to help. Could you explain each of the various compose steps? I'm especially curios why you have a 9 in compose 2?

     

    Seeing this is quite old is there any new and better ways to do this without a third party services of course.


    I supposed that @v-yamao-msft ha used 9 because if you see, you have "Subject" plus ":" plus " " (blank space), so the total characters are 9.

     

    --

    Regards

    Marco

  • Jainil  Profile Picture
    25 on at

    @v-yamao-msft  So the problem I am facing is :  I am getting an email , in email 's body i am getting an email address"  , I need to extract that . Can you suggest something?

  • Community Power Platform Member Profile Picture
    on at

    and by using the "TRIM" expression, this even works when using a table within the html-email-message!

  • Community Power Platform Member Profile Picture
    on at

    you would need to identify the start and the end of your email address. maybe seach for the "@" and the nearest "space" before and after this string?

  • PaulaDawn Profile Picture
    2 on at

    What if there is a space or a line before the data?  

    ItemStock Number Unit PriceDetail TotalStudent ID Card 4182246$0.00$0.00ID
    Number: 10000000      Subtotal:$0.00   Shipping:$1.00   Tax:$0.00   Total:$1.00

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard