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 / 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,443 Super User 2025 Season 2 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

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

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard