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
Unanswered

How to display attachment filename in HTML table for each individual list item

(0) ShareShare
ReportReport
Posted on by 14

Hi All,

 

I have an automated flow where the items added for the past 7 days are sent in an email, plus any attachments.

 

I want the email to show the attachment filename for each individual list item, but currently it is displaying ALL attachment filenames for every item squished together. E.g.

 

katdog888_0-1664492497999.png

 

How do i fix this? Do i need to change the order of the get items / initialize variable actions or the append string variable action? here is my flow:

 

katdog888_1-1664492655431.png

 

katdog888_2-1664492684768.png

katdog888_1-1665621756493.png

 

 

katdog888_0-1665621733079.png

 

Thanks in advance for your help.

 

I have the same question (0)
  • SudeepGhatakNZ Profile Picture
    14,381 Most Valuable Professional on at
    Re: How to display attachment filename in HTML table for each individual list item

    Can you try updating this action as below?

    SudeepGhatakNZ_0-1664493453643.png

     

  • katdog888 Profile Picture
    14 on at
    Re: How to display attachment filename in HTML table for each individual list item

    Won't that just put a line break between each attachment filename...? I want the field to display the file name only for the attachment for a particular list item - not pull all names for all attachments

  • SudeepGhatakNZ Profile Picture
    14,381 Most Valuable Professional on at
    Re: How to display attachment filename in HTML table for each individual list item

    Shouldn't the two Apply to each actions be nested?

    Like,

    SudeepGhatakNZ_0-1664497427199.png

     

  • katdog888 Profile Picture
    14 on at
    Re: How to display attachment filename in HTML table for each individual list item

    I hope i didn't misunderstand your instruction, but i tried to move the Append to String Variable action down into the 2nd Apply to Each loop and now am getting this error - 

    katdog888_0-1664510454246.png

    katdog888_1-1664510462057.png

     

    I also think they're already nested. The way i screenshot is might be misleading. i zoomed out so you can see the full original flow:

    katdog888_2-1664510936528.png

     

    Any ideas? appreciate your help. I just want it to return the file name for attachments on each individual list item. 

  • katdog888 Profile Picture
    14 on at
    Re: How to display attachment filename in HTML table for each individual list item

    Anyone? Please help - i'm lost!

  • SudeepGhatakNZ Profile Picture
    14,381 Most Valuable Professional on at
    Re: How to display attachment filename in HTML table for each individual list item

    @katdog888 

    I have put together a sample flow for you.

    https://1drv.ms/u/s!AiSgXzNMOHCkz17q05kvSyV9GMNy?e=uhjDJd

  • katdog888 Profile Picture
    14 on at
    Re: How to display attachment filename in HTML table for each individual list item

    Hi Sudeep,

    Thanks for putting this together. I tried to replicate your solution into my flow, but it did not work - the attachment details are still pulling through for every list item, even though there is only one attachment on a single list item. The formatting also looks odd.

    E.g. 

    katdog888_0-1665621297078.png

    This is the flow now - 

     

    katdog888_3-1665621420170.png

     

    katdog888_7-1665621622732.png

     

    katdog888_5-1665621458310.png

    katdog888_6-1665621478278.png

     

    Your flow ended at 'compose' but i assume i was supposed to input the Compose action into the HTML table.

    Is there any way to just return the Attachment filename value that corresponds with the list item? And nothing if there is no attachment?

     

    Thanks

    Kat

     

  • SudeepGhatakNZ Profile Picture
    14,381 Most Valuable Professional on at
    Re: How to display attachment filename in HTML table for each individual list item

    HI @katdog888 ,

    I suggest that you run my sample flow separately to understand what I am doing.

    I am looping the list items in the first apply to each

    Looping through the attachments for that specific list items in Apply to each 2

    And then saving the results in an array.

    SudeepGhatakNZ_0-1665634093691.png

    SudeepGhatakNZ_1-1665634201673.png

    SudeepGhatakNZ_2-1665634329244.png

    [
      "['ListItem':'Approval 1','Attachments':''BoA Logo.png\nSB Logo.png\n",
      "['ListItem':'Approval 2','Attachments':''PXL_20220928_052224402.jpg\nPXL_20220928_052247675.jpg\n",
      "['ListItem':'Approval 3','Attachments':''"
    ]

    Once all the items are traversed, the array should have attachment names per list item.

    Start with a simple list and test this flow, then add the logic in yours

     

  • katdog888 Profile Picture
    14 on at
    Re: How to display attachment filename in HTML table for each individual list item

    Hi Sudeep,

     

    The problem is that if I try to input the Compose output into a HTML table from Get Items variables, the array created for attachment names per list item are still pulling through for ALL list items in the HTML table.

    If i initialise and append the array, then I just have a list of list numbers + attachment names  pulling through for every list item in the HTML table.

    What does the 'set variable = null' do?

    And why do you need a 'Compose' action for the array variable? How is this different from just using the variable itself?

  • SudeepGhatakNZ Profile Picture
    14,381 Most Valuable Professional on at
    Re: How to display attachment filename in HTML table for each individual list item

    What does the 'set variable = null' do?

    We need to clear out the attachments variable when we traverse through the next list item, otherwise the attachment array just keeps growing.

    And why do you need a 'Compose' action for the array variable? How is this different from just using the variable itself?

    I just used compose to view the output, it is not required in the flow logic

     

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 722 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 461 Moderator

#3
developerAJ Profile Picture

developerAJ 283

Last 30 days Overall leaderboard