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 / How to get opened Exce...
Power Automate
Unanswered

How to get opened Excel workbook with partial Filename

(0) ShareShare
ReportReport
Posted on by 566

I need to get already opened workbook with partial filename which contains "EXPORT"

i managed to get the full path with "get files into folder" but i cannot get the file with the variable.

Any suggestion?

 

I have the same question (0)
  • VishnuReddy1997 Profile Picture
    2,656 Super User 2025 Season 2 on at

    Hi @Sormick ,

     

    Please ellabroate you issue.If possible share the screenshot of your flow.

    To launch the file with Get Files in Folder action variable is as shown in below image.

    VishnuReddy1997_0-1714472640425.png

     

    (Note:- if you got your solution you can mark as solution and gives kudos)

     

    Thanks & Regards

    Vishnu Reddy

  • Sormick Profile Picture
    566 on at

    Hello @VishnuReddy1997 ,

    Sorry but i'm using the French version of Power app.

    Please find my screenshot below

    1.jpg

    I have a workbook named like this: "EXPORT554545.CSV" which is already opened.

    I need to take control of this workbook by its partiel filename "EXPORT*.CSV" because sometimes i have another workbook opened but with different filename with other digits "EXPORT885533.CSV" 

    Hope this helps.

     

     

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    When you launch Excel, all actions in that Excel belong to %ExcelInstance%; as long as you don't point %ExcelInstance% at another Excel, so if you are running on Excel actions, then it shouldn't change.

     

    Therefore, like @VishnuReddy1997  said below, use Get Files to choose your file and Launch from Get Files.  There has to be some logic to sort out your old file vs new file.

     

    Good luck!

  • VishnuReddy1997 Profile Picture
    2,656 Super User 2025 Season 2 on at

    Hi @Sormick ,

     

    If you use focus window to focus that excel is enough as shown in below image.Irrespective of name of excel it will take the instance and focus that excel.

    Please find the below solution.

     

    VishnuReddy1997_0-1714536214000.pngVishnuReddy1997_1-1714536229886.png

     

    (Note:- if you got your solution you can mark as solution and gives kudos)

     

    Thanks & Regards

    Vishnu Reddy

  • pradeepvarma Profile Picture
    55 on at

    Another alternative is to use the below activity to get the exact file name with the partial name what you have:
    Get files in foler

    In the above activity if you give Export*.xlsx, it would fetch all files with that name in that folder and use the file for further processing as you need.

     

    If it works for you, kindly mark it as a solution.

     

    Regards,

    Pradeep Varma

    Follow on LinkedIn

  • Sormick Profile Picture
    566 on at

    Hi @VishnuReddy1997 ,

     

    Sorry for my late reply.

    Please note that i only need to get the focus of the requested file whch is already opened. I don't need to open it again.

    I managed to get the full path of the requested file with this:

    • Get files in folder with this filter: "export*"
    • For each currentitem in files
    • Focus Window
    • End 

    The issue i have now is that i don't know how to get the focus of this file. it doesn't work with the full path using the variables Currentitem or using Files.

    Any suggestion?

     

  • Verified answer
    VishnuReddy1997 Profile Picture
    2,656 Super User 2025 Season 2 on at

    Hi @Sormick ,

     

    To focus the excel file use Focus window action as mentioned below.

    I have created the similar flow.Please find the solution

    VishnuReddy1997_0-1715764542097.png

     

    Code:

     

    Folder.GetFiles Folder: $'''C:\\Users\\OneDrive\\Desktop\\Power Automate Desktop\\Projects\\BOM Costing\\Templates''' FileFilter: $'''*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files
    LOOP FOREACH CurrentItem IN Files
     SET ToFocusFileName TO $'''%CurrentItem.NameWithoutExtension% - Excel'''
     Text.Trim Text: ToFocusFileName TrimOption: Text.TrimOption.Both TrimmedText=> ToFocusFileName
     Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: CurrentItem.FullName Visible: True ReadOnly: False Instance=> ExcelInstance
     WAIT 2
     UIAutomation.FocusWindow.FocusByTitleClass Title: ToFocusFileName Class: $'''XLMAIN'''
    END

     

    (Note:- if you got your solution you can mark as solution and gives kudos)


    Thanks & Regards

    Vishnu Reddy

  • Sormick Profile Picture
    566 on at

    Thank you so much!

    This flow works perfectly!

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

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard