Hi Everyone,
I've been following this thread here: https://powerusers.microsoft.com/t5/Building-Flows/Extract-text-from-Body-of-an-email-in-Flow/td-p/5...and I'm able to extract the info I need, the problem is the info I need can change in length. For instance:
I'm using an outlook email trigger > HTML to text > initialize variable
substring(body('Html_to_text'),add(lastIndexOf(body('Html_to_text'),'Date'), 15),11)
This works but it will not work if other data changes in the body of the email since it throws the counts off...
An HTML to text ouput would contain:
Name: John Smith ID Number: 666 Office: Ohio Date: 8/23/2019
The issue is I really just need the ID Number and Date values, but they change and can be different lengths.
The ID Number can be 1 digit to 6 digits and the date could be 1/1/2019 (8-10 characters)
Any ideas?
Solved! Go to Solution.
Hi @EricC ,
Please try this expression:
trim(last(split(body('Html_to_text'),'Date:')))
Best Regards,
Hi @EricC
Hi @EricC ,
Please check this similar thread, I have provided an additional method here, please check if it helps you:
https://powerusers.microsoft.com/t5/Building-Flows/Extracting-text-from-email/td-p/334919
It does not need to calculate the length of the message content, by specifying the value to get the data you need.
Best Regards,
@v-bacao-msft This works great! Only issue is for the Date since it is the last part of the body of the email there is nothing after it to tell the expression where to stop. How would I go about solving that piece?
Hi @EricC ,
Please try this expression:
trim(last(split(body('Html_to_text'),'Date:')))
Best Regards,
User | Count |
---|---|
92 | |
45 | |
21 | |
18 | |
16 |
User | Count |
---|---|
136 | |
49 | |
42 | |
36 | |
28 |