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 / How to split the email...
Power Automate
Unanswered

How to split the email body which has different events

(0) ShareShare
ReportReport
Posted on by 10

Hi Team,

 

I have a Email body which has different events in it and which does not have unique content to extract using that into excel.

For Eg: Below is my reference Email body which needs to be extracted into excel.

 

Maintenance1:(This is Event name under this we have the event details in it).

----------------

----------------

----------------

 

Maintenance2:(This is Event name under this we have the event details in it).

---------------

---------------

---------------

 

Maintenance3:(This is Event name under this we have the event details in it).

--------------

--------------

--------------

 

Maintenance1:(This Event also has same name as 1st but this has different event details).

---------------

---------------

---------------

 

Output Required(whichever(1or 2) is possible)

1. Need to extract each event data into excel

2. Need to split each event separately and need to extract the each event details into excel.

 

 

Challenges am facing: Since the Email body contains similar event names, am unable to extract using the unique content whereas I didnot have any unique content to trim/split using that. the expected output is not getting.

 

Is there any other functions we have to get this?

 

Note: Each events are splitted using space only.

 

 

Please help me on this to get the expected output. Thanks!!

 

Regards,

Yuvarani D

Categories:
  • SanmeshG Profile Picture
    1,956 Moderator on at

    Hi @YuvaraniD ,

     

    Can you share the html of the email body ?

  • YuvaraniD Profile Picture
    10 on at

    Hi..
    Please find the HTML sample of the mail.

     

    <p><html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="Generator" content="Microsoft Word 15 (filtered medium)"><style>
    <!--
    @font-face
    {font-family:"Cambria Math"}
    @font-face
    {font-family:Calibri}
    p.MsoNormal, li.MsoNormal, div.MsoNormal
    {margin:0in;
    font-size:11.0pt;
    font-family:"Calibri",sans-serif}
    span.EmailStyle17
    {font-family:"Calibri",sans-serif;
    color:windowtext}
    .MsoChpDefault
    {font-family:"Calibri",sans-serif}
    @page WordSection1
    {margin:1.0in 1.0in 1.0in 1.0in}
    div.WordSection1
    {}
    -->
    </style></head><body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word"><div class="WordSection1"><p class="MsoNormal">Merchant Services </p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Image </p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Image </p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">MERCHANT SERVICES</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">STATUS DASHBOARD</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Maintenance</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Software Maintenance</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Scheduled</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">No Action Required</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Context on what happens during Maintenance</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Reference Number: </p><p class="MsoNormal">Start Time: </p><p class="MsoNormal">End Time: </p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Components Affected</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Components Affected1</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Components Affected2</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Hardware Maintenance</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Scheduled</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">No Action Required</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Context on what happens during Maintenance</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Reference Number: </p><p class="MsoNormal">Start Time: </p><p class="MsoNormal">End Time: </p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Components Affected</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Components Affected1</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Software Maintenance</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Scheduled</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">No Action Required</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Context on what happens during Maintenance</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Reference Number: </p><p class="MsoNormal">Start Time: </p><p class="MsoNormal">End Time: </p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Components Affected</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Components Affected1</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Components Affected2</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Components Affected3</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Hardware Maintenance</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Scheduled</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">No Action Required</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Context on what happens during Maintenance</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Reference Number: </p><p class="MsoNormal">Start Time: </p><p class="MsoNormal">End Time:</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Components Affected</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Components Affected1</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Components Affected2</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Components Affected3</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">ABOUT THIS MESSAGE</p><p class="MsoNormal">Merchant Updates</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Disclaimer</p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">Manage your subscription.</p><p class="MsoNormal">Link </p><p class="MsoNormal">&nbsp;</p><p class="MsoNormal">&nbsp;</p></div></body></html></p>

  • SanmeshG Profile Picture
    1,956 Moderator on at

    Thanks for sharing , can you please paste it in the Code view , so that it's easy to copy. Use </> to paste it in code view.

  • YuvaraniD Profile Picture
    10 on at

    Please find the code attached. Is that fine?

     

  • SanmeshG Profile Picture
    1,956 Moderator on at

    Hi @YuvaraniD ,

     

    That helps , but it is very inconsistent , because if everything is an event , then it needs to have Start Time and End Time, which is not the case.

     

    Are we missing something? What is the source of this ?

     

    I thought we can try it with an xpather but not sure about the consistency of the HTML.

  • YuvaraniD Profile Picture
    10 on at

    Hi,

     

    Here, everything is an event and each event has its own Reference Number, Start and End date. 
    but we dont have any unique item in each event in the mail to extract.

  • AlexEncodian Profile Picture
    4,409 Moderator on at

    @YuvaraniD 

    Are the vent names unique (even if its just the suffix Event2)? And are they always the same or different email to email?

  • YuvaraniD Profile Picture
    10 on at

    Hi... The event names are different for each email. and also the same email contains a similar event name as well.

  • sandeepstw Profile Picture
    312 Moderator on at

    To extract each event data separately from the email body and export it to Excel using Power Automate, you can follow these steps:

    1. Start your Power Automate flow with a trigger that indicates the receipt of an email, such as "When a new email arrives (V3)".

    2. Add a "Compose" action to extract the email body content. In the "Inputs" field of the "Compose" action, enter the expression triggerBody()['body'].

    3. Use the "Split" function to split the email body into separate events based on the "Maintenance" keyword. Add a "Compose" action after the previous "Compose" action and set its "Inputs" field to split(outputs('Compose'), 'Maintenance').

    4. Add a "Filter array" action to remove any empty elements from the split result. In the "From" field of the "Filter array" action, enter outputs('Compose_2'). In the "Condition" field, enter item()?['Value']?['Length'] > 0.

    5. Now, you have an array of events, and each event can be accessed using the expression body('Filter_array')?[x]['Value'], where x is the index of the event (starting from 0).

    6. To export the events to Excel, you can use the "Create table" action or "Add row to a table" action from the Excel Online (Business) connector. Configure the action by providing the necessary details, such as the Excel file, worksheet name, and the event details to be added as rows in the table.

    7. To iterate through the array of events, use the "Apply to each" control action. Place the "Create table" or "Add row to a table" action inside the "Apply to each" control, and set the input to body('Filter_array').

    8. Save and test your flow with sample emails that contain multiple events to verify the extraction and export process.

    By following these steps, you should be able to split the email body into separate events and export the event details to an Excel file using Power Automate.

     

  • YuvaraniD Profile Picture
    10 on at

    thanks , will follow the above steps and update on that.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 377

#2
11manish Profile Picture

11manish 302 Super User 2026 Season 2

#3
Henil Profile Picture

Henil 130

Last 30 days Overall leaderboard