Skip to main content
Power Automate
    • Connectors
    • Templates
    • Take a guided tour
    • Digital process automation
    • Robotic process automation
    • Business process automation
    • Process advisor
    • AI Builder
  • Pricing
  • Partners
    • Blog
    • Documentation
    • Roadmap
    • Self-paced learning
    • Webinar
    • Business process and workflow automation topics
    • Overview
    • Issues
    • Give feedback
    • Overview
    • Forums
    • Galleries
    • Submit ideas
    • User groups
    • Register
    • ·
    • Sign in
    • ·
    • Help
    Go To
    • Microsoft Power Automate Community
    • Welcome to the Community!
    • News & Announcements
    • Get Help with Power Automate
    • General Power Automate Discussion
    • Using Connectors
    • Building Flows
    • Using Flows
    • Power Automate Desktop
    • Process Advisor
    • AI Builder
    • Power Automate Mobile App
    • Translation Quality Feedback
    • Connector Development
    • Power Platform Integration - Better Together!
    • Power Platform Integrations
    • Power Platform and Dynamics 365 Integrations
    • Galleries
    • Community Connections & How-To Videos
    • Webinars and Video Gallery
    • Power Automate Cookbook
    • Events
    • 2021 MSBizAppsSummit Gallery
    • 2020 MSBizAppsSummit Gallery
    • 2019 MSBizAppsSummit Gallery
    • Community Engagement
    • Community AMA
    • Community Blog
    • Power Automate Community Blog
    • Community Support
    • Community Accounts & Registration
    • Using the Community
    • Community Feedback
    cancel
    Turn on suggestions
    Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
    Showing results for 
    Search instead for 
    Did you mean: 
    • Microsoft Power Automate Community
    • Galleries
    • Power Automate Cookbook
    • Extract and parse data from an email

    Extract and parse data from an email

    05-19-2020 23:27 PM - last edited 05-20-2020 08:26 AM

    Django
    MVP
    66155 Views
    LinkedIn LinkedIn Facebook Facebook Twitter Twitter
    Django
    Django
    MVP
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    Extract and parse data from an email

    ‎05-19-2020 11:27 PM

    Title: Data extraction and parsing from an email

     

    Description: This Flow triggers on an email received to check its body on a dynamic number of keys to find its corresponding value. The trick is in an Apply to each loop based on an array you can manage from within the flow. The flow will find the keys and values you want to extract and parse.

     

    Detailed Instructions: It’s as easy as importing the zipped flow attached, add your connection for Outlook Office 365 and it will trigger on your own inbox emails. I recommend additional filters (like a specific unique phrase in the subject or only a specific mailbox folder) so the flow will only trigger on emails that it should trigger on. Keep in mind that the flow expects a specific key to find and you can change the key in the array step of the flow. You can even change the key-value separator as explained in the video.

     

    Questions: Please feel free to ask anything right here as a reply in this post.

     

     

     

    watch?v=e_8hQibvbYQ

    Preview file
    61 KB
    FlowTest-EmailgetData_20200520061714.zip
    Labels:
    • Labels:
    • Automated Flows
    Message 1 of 48
    66,155 Views
    18 Kudos
    Reply
    • All forum topics
    • Previous Topic
    • Next Topic
    • « Previous
      • 1
      • 2
      • 3
      • 4
      • 5
    • Next »
    MikhailPeru
    MikhailPeru
    New Member
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎06-12-2020 09:18 AM

    Hi Django,

    Firstly, thanks a lot for sharing. I'd like to ask you just one additional question.

    If I have a table in the email (not attached but written in the email), can I also find a way to extract the values?

    Thanks so much, greetings from Perú

    Mikhail

     

     

     

    Message 2 of 48
    56,931 Views
    3 Kudos
    Reply
    Django
    Django
    MVP
    In response to MikhailPeru
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎06-22-2020 12:06 AM

    Hi @MikhailPeru ,

    The concept in an HTML table is a bit different becaus table cells are between the tags <td> and </td>.

    This concept enforces the business rule that the key and the value are between the same type of separator: ||

     

    The concept of a table should also be possible but then you would have to add additional logic:

    My concept: ||key||||value||

    HTML concept: <td>key</td><td>value</td>

     

    My recommendation: parse the html to a string and replace every <td> and </td> with || and then my concept should be applicable:

    My concept: ||key||||value||

    HTML concept: <td>key</td><td>value</td>

    Replaced <td> and </td> within HTML string with ||: ||key||||value||

    Message 3 of 48
    56,815 Views
    1 Kudo
    Reply
    ntahal_eagleone
    ntahal_eagleone
    Regular Visitor
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎07-28-2020 04:46 AM

    Hi @Django thanks for sharing this parsing method using objects and array.

    You are using one separator, How do you include another symbol

    Like value is after = symbol and ends before <br>.

    My sample text below. I need to separate 8 keys and values

     

    <p>
    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta content="text/html; charset=utf-8">
    </head>
    <body>
    Node Name=9981, Angeles (TCID: **-ALZ-****)<br>
    Node Type=Network<br>
    Node IP=***.17.**.*1<br>
    Node Utilization=20 ms<br>
    Node Tier=Tier2<br>
    Node Site=Branch Site<br>
    Node Status=Up<br>
    Node Alert Date/Time=2020-07-28T18:08:05<br>
    Node Application=Network</body></html></p>

    Message 4 of 48
    56,434 Views
    1 Kudo
    Reply
    Django
    Django
    MVP
    In response to ntahal_eagleone
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎07-30-2020 04:36 AM

    Hi @ntahal_eagleone ,

    My answer will be a lot like my answer to @MikhailPeru on 22JUN.

     

    My concept is keeping the format of the data structure simple to:

    1-avoid to much complex logic in the flow so we can create one Apply to each loop that will get all values of every key

    2-focus on the flexibility in the key possibilities to find the matching values

     

    So my first recommendation is to change your datastructure so you can apply my concept.

    If this is not possible, you could check to parse your HTML to string and then replace every <br>, every = and the first <body> with || to see if my concept can be applied:

    My concept: ||key||||value||

    HTML concept: <body>key=value<br> or <br>key=value<br>

    Replaced <br>,= and <body> within string with ||: ||key||||value||

    Message 5 of 48
    56,375 Views
    1 Kudo
    Reply
    bizysiby
    bizysiby
    New Member
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎07-31-2020 12:07 AM

    Django Hi,

     

    Hope you are doing good...

     

    I am totally new to Flows - been upskilling since a week...

    > Been a "functional" Business analyst last 13 years. But due to a new project, am skilling in this technology

    > Executed quite a few exercises within MS Flows

     

    I used this flow - imported and tried to run after setting up connectors. But the flow doesnt execute...

    Maybe I missed some settings/configurations...

    Could you advise?

     

    Thanks in advance

     

    Sibs

    Preview file
    61 KB
    Message 6 of 48
    56,346 Views
    1 Kudo
    Reply
    Django
    Django
    MVP
    In response to bizysiby
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎08-03-2020 12:42 AM

    Hi @bizysiby,

    Does the flow not run at all or does it fail?

    In this Flow Template, there is the first trigger action to start on new emails received with additional filters about the subject to contain specific text:

    PowerAutomate_EmailParseDataTrigger.png

    Did you remove all additional filters and test to see if the emails received to the specified inbox are triggering the Flow?

    Message 7 of 48
    56,307 Views
    1 Kudo
    Reply
    bizysiby
    bizysiby
    New Member
    In response to Django
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎08-03-2020 01:28 AM

    Hi Django,

    Cool thanks for this 🙂

    Very silly of me to miss that out.

    The flow executed,

    Sibs

    Message 8 of 48
    56,305 Views
    1 Kudo
    Reply
    mxlgbr
    mxlgbr
    Regular Visitor
    In response to Django
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎08-11-2020 06:28 AM

    Hi @Django,

     

    thank you for sharing the content, very cool!

     

    I find myself in the same situation as @ntahal_eagleone. With this in mind it would be great to get more of your thoughts regarding the suggestion to parse the HTML to string and then replace every <br>, every = and the first <body> with ||. How could this be done with Automate?

     

    Thank you!

    Message 9 of 48
    56,069 Views
    0 Kudos
    Reply
    Django
    Django
    MVP
    In response to mxlgbr
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎08-12-2020 05:53 AM

    Hi @mxlgbr ,

    The Substitute expression of Power Automate would be the way to go: https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#r...

     

    Something like:

    replace(replace(replace('<body>Node Name=9981, Angeles (TCID: **-ALZ-****)<br>Node Type=Network<br>','<body>','||'),'=','||||'),'<br>','||||')

    would result in

    ||Node Name||||9981, Angeles (TCID: **-ALZ-****)||||Node Type||||Network||||

     

    A big assumption here is that any other part of the rest of your email does not contain the strings being replaced themselves (nowhere else should be the string combination of <body> OR = or <br> or they will get replaced also) so again --> you should tackle this problem at the source and make sure that your output is consistent like:

    ||Node Name||||Name of the Node||
    ||Node Type||||Type of the Node||

     

    Message 10 of 48
    56,017 Views
    1 Kudo
    Reply
    • « Previous
      • 1
      • 2
      • 3
      • 4
      • 5
    • Next »

    Power Platform

    • Overview
    • Power BI
    • Power Apps
    • Power Pages
    • Power Automate
    • Power Virtual Agents

    • Sign up free
    • Sign in

    Browse

    • Templates
    • Connectors
    • Partners

    Downloads

    • Mobile
    • Gateway

    Learn

    • Documentation
    • Learn
    • Support
    • Community
    • Give feedback
    • Blog
    • Pricing

    • © 2023 Microsoft
    • Contact us
    • Trademarks
    • Privacy & cookies
    • Manage cookies
    • Terms of use
    • Terms & conditions
    California Consumer Privacy Act (CCPA) Opt-Out Icon Your California Privacy Choices