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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Parsing Variable Numbe...
Power Automate
Unanswered

Parsing Variable Number of File Types from Email Body

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I'm new to automate and trying to extract file names from routine notification emails. The hang up for me is the varying number of files that may be listed in each email body preview (example below):

John Doe uploaded 2 documents:

""

File_1.xls
""

Version 8

""

File_2.xls

""

Version 16

""

Folder Location/Test/Files

Open folder

Is there a way I can isolate and extract the whole File_#.type line for each instance as the number varies? I was able to consistently get the first one using split but I can't think of a good way to get all of them and I've seen up to 9 in a single email notification. Any suggestions are much appreciated. Thanks!

Categories:
  • Rhiassuring Profile Picture
    8,692 Moderator on at

    Hi there, 

     

    Well, are you going to get the "." anywhere else? Do you have minor versions? If not, this would work for you (the txtFiles is my copy/paste of your example text): 

     

    Compose:   split(variables('txtFile'),decodeUriComponent('%0A'))

    Filter Array:  item() contains .

    Rhiassuring_0-1651127968544.png

     

    The output is an array with only the file names in it.

    Rhiassuring_1-1651128059768.png

     

    If there IS a likelihood of the Version having a . in it, we could always filter those OUT of the array first.

     

    Let me know.


    Cheers,

     

    Rhia

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    This produces the desired output from my 'Filter array' action, but is there away to add each of these returns as a row in a table?  My end goal is to return each file name with the date and time as separate rows.  Thank you for the help!

  • Rhiassuring Profile Picture
    8,692 Moderator on at

    Into a table in an Excel spreadsheet? Is the date coming from the email as well - or is it just "today"? (Or will that always be the same?) 

    But yes you can totally do that. 

    I can give you a more specific response when I know the deets but, overall:

    1) Create an Apply to Each

    2) Cram the output from your Filter Array in there

    3) Create an "Add row to table" Excel action
    4) In your FileName column, use this expression: items('Apply_to_each') 

    5) In your Date column, use this expression: div(sub(ticks(formatDateTime(utcNow(), 'yyyy-MM-ddT00:00:00')),599264352000000000),864000000000)

     

    NOTE: The Date is assuming you want to use today's date and put it into a cell in your Excel table that is formatted as a date value. If you're just dropping it in as a string, you can ignore that and just use dynamic content.

    Then it'll loop through and add each one of the files that were output.

     

    Cheers,

     

    Rhia

     

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 299

#2
11manish Profile Picture

11manish 274 Super User 2026 Season 2

#3
Henil Profile Picture

Henil 119

Last 30 days Overall leaderboard