
Announcements
Hello,
I'm trying to create my first flow, and I need it to automatically save email attachments to one drive. I've got that part figured out.
What I'm struggling with is if there's a way to pull a text from the email contents and use that as the name of the file. It's always the 6th "word" of the email body and it's a string of 4 numbers (could eventually be 5). I've tried html from text and compose. I've also tried find text position and substring. Can I get some help?
Hi @apasuf
First, add a action 'Initialize a variable' and name it 'FileName'.
Add a 'Compose' action and then Split the email body into words:
split(triggerBody()?['Body'], ' ') //This will give you an array of words.
Now fill the variable by using the action 'Set the variable'. You can set the FileName variable to the 6th word. Array indices start from 0, so the 6th word will be at index 5.
outputs('Compose')?[5]
I also got some inspiration from https://powerusers.microsoft.com/t5/General-Power-Automate/Manipulate-filename-from-email-attachment/td-p/79663
If you have any questions or feedback, please let me know. Have a great day! 😊
-----------------------
PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube]
I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻