web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Building a flow to retrieve string from body of email and post to Excel

(0) ShareShare
ReportReport
Posted on by 40
I am attempting to write a flow to retrieve specific text from an email response. Then I want to store that response in an Excel table. I am currently blocked on retrieving the text. 
 
My flow actions:
  1. When a new email arrives
  2. HTML to text
  3. EnterKey (Add newline delimiter)
  4. Split Body Text (split text into array of strings)
  5. Initialize a few variables...
  6. Compose (to find if my string is in the array element)
    1. contains(items('Split_Body_Text'), variables('varCommitted'))
  • It is on step 6 where the flow fails. (This is just a test to see if it works. I plan to change this to Apply to each so I can loop through the array of strings.)
  • I see that my input shows as false so that seems to be the problem. I sent an email with a single sentence and confirmed step 4 sees that array with one element.
  • I'm not sure why this is false as the contains function should take the array of strings from step 4. I've checked to confirm, the collection can be string or array you want to search within. This can be a variable, dynamic content, or a literal value. 
  • This is the first area I'm looking for help with. 
 
 
Ultimately I want to put this into an Apply_to_each and loop through the array of strings until I’ve found the first instance of the text I am searching for.
The condition is an AND:
  1. Function above except changing the input to be each element of the array from the Apply : contains(items('Apply_to_each'), variables('varCommitted'))
  2. varArray is not equal to zero
 
In the Yes path I have following actions:
  1. Update my varArray so it stores the position of the text found in the array.
    1. Can I do this and reference it later?
  2. Increment the counter so it'll stop processing the loop
Once I the loop is done processing, I plan to set some actions to:
  1. Find the email address from the subject line of the email
  2. Store email address from subject line of email in variable
  3. Open Excel file
  4. Filter the table by the email variable
  5. Update each row with the response in Committed variable
Does this overall flow process make sense? What suggestions changes would you make?
 
Thank you
I have the same question (0)
  • Verified answer
    VictorIvanidze Profile Picture
    12,875 on at
    Building a flow to retrieve string from body of email and post to Excel
    Hi,
     
    for the test purpose (where you have only one text string), use the the following:
     
    contains(items('Split_Body_Text')[0], variables('varCommitted'))
    or
    contains(first(items('Split_Body_Text')), variables('varCommitted'))
  • RolloV Profile Picture
    40 on at
    Building a flow to retrieve string from body of email and post to Excel
    Hi, thanks for the tip. I forgot I could access the elements like that. 
    That also got me going on the right path for my loop. I've got it all working now and just need to add steps to update the rows in Excel. 
    Thank you very much!

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 614 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 401 Moderator

#3
chiaraalina Profile Picture

chiaraalina 282

Last 30 days Overall leaderboard