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 / PAD > UI Automation > ...
Power Automate
Unanswered

PAD > UI Automation > looping through Excel files using variable

(0) ShareShare
ReportReport
Posted on by 4
Hi,
 
My end goal is to loop through Excel Files and run power queries for desktop (ideally I cloud like this one the cloud but until Excel Online supports Power Queries (external sources) I am stuck with Power Automate Desktop).
 
With PAD (one flow) with variables
opening and going through the UI to refresh some specific queries is fine. 
opening a second file is fine but the UI Automation is still going to the first file:
 
:desktop > window[Name@="^(.*)%file_name_2%(.*)Excel$"][Process="EXCEL"] > pane[Class="EXCEL2"]:eq(0) > ....
I also tried 
:desktop > [Process="EXCEL"] > pane[Class="EXCEL2"]:eq(0) >....
 
in both case the second file is ignored (even with %file_name_2%), it's still associated with the first file / initial file used to create the first loop.
 
....I don't get it, it looks like there is hidden reference somewhere.
Categories:
I have the same question (0)
  • Nived_Nambiar Profile Picture
    18,129 Super User 2025 Season 2 on at
    Hi
     
    So when you say automation is going through second file even first file, so the first excel file is opened as well ?
     
    Also can you share the flow design ?
     

    Thanks & Regards,
    Nived N

    Stay connected:
    LinkedIn | YouTube | Blogs

    Was this answer helpful?
    If yes, please mark it as the solution by selecting the checkbox in the discussion thread.
    Your feedback motivates me to keep contributing. Thank you!

  • JeromeCrametz Profile Picture
    4 on at
    Hi Nived,
    If swap my second file with my first / Intial file, well it fails so it's still referring the initial file that was used to built the 1st loop.
     
    I must do something wrong:
     
    I create my 2 variables: 
    Set variable File_Path
    Set variable File_Name
    Launch Excel with %file_path%%file_name%
     
    I use the "Inspect UI Tool" to select the Data Tab 
    > pane[Class="EXCEL2"]:eq(0) > toolbar[Class="MsoCommandBar"] > pane[Class="MsoWorkPane"][Name="Ribbon"] > pane[Class="NUIPane"] > pane[Class="NetUIHWNDElement"] > pane[Class="NetUInetpane"][Name="Ribbon"] > tab[Class="NetUIPanViewer"][Name="Ribbon Tabs"] > tabitem[Class="NetUIRibbonTab"][Id="TabData"]
     
    and edit the UI Element to add: 
     :desktop > window[Name@="^(.*)%file_name%(.*)Excel$"][Process="EXCEL"] 
     
    so I have 
     :desktop > window[Name@="^(.*)%file_name%(.*)Excel$"][Process="EXCEL"] > pane[Class="EXCEL2"]:eq(0) > toolbar[Class="MsoCommandBar"] > pane[Class="MsoWorkPane"][Name="Ribbon"] > pane[Class="NUIPane"] > pane[Class="NetUIHWNDElement"] > pane[Class="NetUInetpane"][Name="Ribbon"] > tab[Class="NetUIPanViewer"][Name="Ribbon Tabs"] > tabitem[Class="NetUIRibbonTab"][Id="TabData"]
     
    and this will only works with the file used with the "Inspect UI Tool" it's not dynamic. 
     
     
  • JeromeCrametz Profile Picture
    4 on at
    I found my rookie mistake.... the dynamic element needs to be setup in each UI Elements in the UI Element selector not directly in the Text editor of the UI Automation action
     
     
    So in the UI Element section: 
    window element set 
    :desktop > window[Name@="^(.*)%file_name_2%(.*)Excel$"][Process="EXCEL"] 
    UI Element set
    > pane[Class="EXCEL2"]:eq(0) > ....
     
     
     
     

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

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard