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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / click download link in...
Power Automate
Answered

click download link in Dynamic table

(0) ShareShare
ReportReport
Posted on by 26

Hello! 

I'm a Power BI Dev who has ended up with some power automate in his lap! and I'm hoping the power automate community is just as good as the BI one! 

I'm trying to set up a flow to automatically download files off a supply portal. I got to the part where we actually need to click download. 

Magpie_Rob_0-1626812895031.png

so in the table in the screenshot, I need to click on the blue items which in turn downloads a .xlxs file.
I have a kind of dogy work around at the moment which I have included below, which basically uses a load of if statements

Magpie_Rob_1-1626813187541.png

Is there a way to iterate this based on the number of UI elements within the table and perform the downloads? 

My next step is to get all the details from the separate sheets (they have the same structure) and upload them to a SQL DB. (I'm sure there will be more posts). 

Thanks 

Rob

 

I have the same question (0)
  • tkuehara Profile Picture
    667 on at

    Hi @Magpie_Rob 

     

    Welcome here!

    Yes, you can iterate UI elements by changing them to a dynamic one.

    Could you provide a print from your element selector?

  • Magpie_Rob Profile Picture
    26 on at

    Hi @tkuehara thanks for responding. not sure which part of the element selector you mean but I have included the below 

    Magpie_Rob_0-1626815243634.png

     

  • tkuehara Profile Picture
    667 on at

    Oh dang! I forgot asking you for the page's HTML structure haha but I'll assume the dynamic part should be the rows.

    In this case, you need to customize your selector from:

    html > body > div:eq(3) > div:eq(0) > div:eq(1) > div > div:eq(1) > div:eq(5) > div > div:eq(1) > div > div > div:eq(1) > table > tbody > tr:eq(0) > td:eq(0) > div:eq(0) > a

    To:

    html > body > div:eq(3) > div:eq(0) > div:eq(1) > div > div:eq(1) > div:eq(5) > div > div:eq(1) > div > div > div:eq(1) > table > tbody > tr:eq(%i%) > td:eq(0) > div:eq(0) > a

    If your table always have the same size (4 rows) then you can execute a simple loop from 0 to 3:

    tkuehara_0-1626815862441.png

     

  • Magpie_Rob Profile Picture
    26 on at

    Not sure how to tell you the page's HTML structure (sorry I'm a complete novice). But I have included my best guess screenshot below. 

    Magpie_Rob_0-1626816906974.png

     


    I did see this solution in another post! with the %i% but this doesn't seem to work in my flow! see the error message I get below.

    Magpie_Rob_0-1626816372248.png

    and the table size in this is dynamic I'm not sure on the maximum number of rows hence wanting the iterator to work and not have to input 50 if statements. 

     

    Thanks 

  • Verified answer
    tkuehara Profile Picture
    667 on at

    Perfect! Thanks.

     

    I can see the link goes in the same first div in the same first column (td element) on each row. The selector should work then. Just add the loop, generating the variable %i%.

     

    In this case (dynamic table) you can't perform a fixed loop. I'd go for a JS solution to count row numbers and then use it to loop each row in the table (don't know if you are familiar to JS though).

    From what I can see, this JS script should work (unless you have iframes in the page):

    function ExecuteScript() {
          var myRows = document.querySelectorAll('table#sharedreport-external-details-table > tbody > tr');
          var count = myRows.length;
          return count;
    }


    Here's how your flow should look like (simplified version, and you can ignore the Launch new Chrome - I just did it to generate the %Browser% variable):

    tkuehara_0-1626817579892.png

    1. The Javascript action will be used to count the number of rows;
    2. As JS action returns a text type, you'll need to convert to number before using it in the loop action;
    3. Finally, the loop action will iterate from 0 to Result-1 and store the value at the variable %i% which will be the dynamic row selector. This way you can have a single "Click link on web page" action inside the loop action clicking at the links on each table row.
  • Magpie_Rob Profile Picture
    26 on at

    Hi @tkuehara thanks so much this is very nearly working! 

    so I can't seem to put the result as result -1 in the loop... am I missing something... 

    Magpie_Rob_0-1626899227767.png

     

    is this what would be causing my flow to fail at the end? 

    Magpie_Rob_1-1626899503290.pngthanks 

    Rob

     




  • tkuehara Profile Picture
    667 on at

    Hi @Magpie_Rob, glad it is almost there!

     

    Yes, it is the cause of the error at the end. You need to put the number inside the "%" signs: %JSResult - 1%

     

  • Magpie_Rob Profile Picture
    26 on at

    thanks @tkuehara thats all now working, amazing! thanks for all your help! Kudos and Accepted solution incoming 

  • tkuehara Profile Picture
    667 on at

    Great! Tks buddy 😄

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard