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?