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 e...
Power Automate
Unanswered

Extracting text from email and filling a table in Sharepoint or Excel

(0) ShareShare
ReportReport
Posted on by 42

Hi everybody

 

I have a recurrent daily email with information like this (is a short example):

 

0301: RESERVATION_DAILY_ELEMENTS , RESORT_ROOM_CAT_COMBINATIONS , TRX_CODES , PK_RESERVATION_SUMMARY

0305: RESORT_ROOM_CAT_COMBINATIONS , TRX_CODES

0312: RESERVATION_DAILY_ELEMENTS , RESORT_ROOM_CAT_COMBINATIONS , RESORTS_ROOM_CATEGORY , TRX_CODES

0313: RESORT_ROOM_CAT_COMBINATIONS , TRX_CODES

0322: RESERVATION_DAILY_ELEMENTS , RESORT_ROOM_CAT_COMBINATIONS , RESORTS_ROOM_CATEGORY , TRX_CODES

0705: RESERVATION_DAILY_ELEMENTS , RESORT_ROOM_CAT_COMBINATIONS , TRX_CODES

0706: RESORT_ROOM_CAT_COMBINATIONS , TRX_CODES , FIXED_CHARGES

0720: ALLOTMENT_DETAIL , ALLOTMENT_HEADER , EXTERNAL_REFERENCES , FINANCIAL_TRANSACTIONS , FOLIO_TAX , NIGHT_AUDIT_JOURNAL , PRODUCT_POSTING_RULES , REP_MANAGER , RESERVATION_DAILY_ELEMENT_NAME , RESERVATION_DAILY_ELEMENTS , RESERVATION_NAME , RESERVATION_PRODUCT_PRICES , RESERVATION_STAT_DAILY , RESERVATION_SUMMARY_LOG , RESERVATION_SUMMARY , RESORT_ROOM_CAT_COMBINATIONS , ROOM_CATEGORY_STATISTICS 

 

and I need to extract this info and fill a table in this way with a Power Automate flow:

 

CODETABLE
0301RESERVATION_DAILY_ELEMENTS
0301RESORT_ROOM_CAT_COMBINATIONS
0301TRX_CODES
0301PK_RESERVATION_SUMMARY
0305RESORT_ROOM_CAT_COMBINATIONS
0305TRX_CODES
0312RESERVATION_DAILY_ELEMENTS
0312RESORT_ROOM_CAT_COMBINATIONS
0312RESORTS_ROOM_CATEGORY
0312TRX_CODES
0313RESORT_ROOM_CAT_COMBINATIONS
0313TRX_CODES
0322RESERVATION_DAILY_ELEMENTS
0322RESORT_ROOM_CAT_COMBINATIONS
0322RESORTS_ROOM_CATEGORY
0322TRX_CODES
0705RESERVATION_DAILY_ELEMENTS
0705RESORT_ROOM_CAT_COMBINATIONS
0705TRX_CODES
0706RESORT_ROOM_CAT_COMBINATIONS
0706TRX_CODES
0706FIXED_CHARGES
0720ALLOTMENT_DETAIL
0720ALLOTMENT_HEADER

etc, etc

 

I really appreciate some help to do this. 

Categories:
I have the same question (0)
  • Rhiassuring Profile Picture
    8,690 Moderator on at

    Sure. Here's the output I achieved:

     

    Rhiassuring_0-1700248071291.png


    The flow will look something like this.

     

    Initialize your variables. Email is just a copy of the text you gave me so I could use it.  NewLine is just a string variable that I hit "enter" in.  Array is an empty array for the new data.

    Rhiassuring_1-1700248167155.png

     

    Split your email content by the NewLine variable. Then, filter out the empty lines.

     

    Rhiassuring_2-1700248196841.png

    Enter into an Apply to Each on the body from the Filter Array.

     

    Set your variable for the Code with the following expression: 

    first(split(items('Apply_to_each'),':'))
     
    Then, split the current item on the commas (after removing the code from the line) using this expression:
    split(substring(items('Apply_to_each'),5,sub(length(items('Apply_to_each')),5)),',')

     

    Rhiassuring_3-1700248230214.png

    Then, iterate through the newly split items. Here all we're doing is appending the vales to our array.

    Rhiassuring_4-1700248301172.png

     

    On the outside of your Apply to Each, you now have an array you can do whatever you need to with. I created an HTML table, which you saw at the beginning of this post.

     

     

     

     

     

     

     

     

     

     

  • MikeAA Profile Picture
    42 on at

    Hi @Rhiassuring excellent solution, the only thing i didn't understand was: "New Line is just a string variable that I hit "enter" in". How do I hit "enter" I don't understand.

    Thanks in advance

  • Verified answer
    Rhiassuring Profile Picture
    8,690 Moderator on at

    On your keyboard, the "enter" button. Carriage return. 

     

    You just click into the field, and press the enter key on your keyboard. 

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