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 / Selecting data out of ...
Power Automate
Answered

Selecting data out of email body

(0) ShareShare
ReportReport
Posted on by 2
I am a complete beginner and have created my first Cloud-flow that reads data from the email body and writes it to Excel. My approach is probably not elegant, but in principle it works quite well using the “Initialize variable” action. To cut out the appropriate pieces, I use the following function to search for the beginning and end of the desired string between the two text snippets “Hours:” and “Reason:” because the text changes in between.
Slice(body('Html_to_text'),nthIndexOf(body('Html_to_text'),'Hours: ',1),nthIndexOf(body('Html_to_text'),'Reason:',1))

The idea is that the string is cut out after “Hours:” and until before “Reason:”. Unfortunately, the text “Hours:” is also always cut out because the “nth index of hours:” begins with “S…”. I tried to add the appropriate number of characters to the “nth index” with the following version:
Slice(body('Html_to_text'),nthIndexOf(body('Html_to_text'),'Hours: ',1)+8,nthIndexOf(body('Html_to_text'),'Reason:',1))

However, this is rejected as an invalid function because the syntax of “Slice” apparently does not allow it.
 
I could just use the ":" as separator and count occurences. But it doesn't solve the issue (just minimizes it) as I will still have the ":" in the text retrieved. 
 
Does anyone have an idea how I can solve the problem with my cloud flow?
 
Categories:
I have the same question (0)
  • Verified answer
    Chriddle Profile Picture
    8,605 Super User 2026 Season 1 on at
    slice() with a small s ;)
     
    instead of +8 use function add()

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!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 103 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 87

#3
trice602 Profile Picture

trice602 63 Super User 2026 Season 1

Last 30 days Overall leaderboard