Skip to main content
Community site session details

Community site session details

Session Id : tvSypiSwG8mSCyvW9Lmj3P
Power Automate - Power Automate Desktop
Answered

How to get opened Excel workbook with partial Filename

Like (0) ShareShare
ReportReport
Posted on 30 Apr 2024 09:42:21 by 508

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?

 

  • Sormick Profile Picture
    508 on 16 May 2024 at 07:42:48
    Re: How to get opened Excel workbook with partial Filename

    Thank you so much!

    This flow works perfectly!

  • Verified answer
    VishnuReddy1997 Profile Picture
    2,526 Super User 2025 Season 2 on 15 May 2024 at 09:16:44
    Re: How to get opened Excel workbook with partial Filename

    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
    508 on 15 May 2024 at 08:44:07
    Re: How to get opened Excel workbook with partial Filename

    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?

     

  • pradeepvarma Profile Picture
    55 on 10 May 2024 at 09:21:43
    Re: How to get opened Excel workbook with partial Filename

    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

  • VishnuReddy1997 Profile Picture
    2,526 Super User 2025 Season 2 on 01 May 2024 at 04:04:28
    Re: How to get opened Excel workbook with partial Filename

    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

  • MichaelAnnis Profile Picture
    5,721 Moderator on 30 Apr 2024 at 17:27:20
    Re: How to get opened Excel workbook with partial Filename

    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!

  • Sormick Profile Picture
    508 on 30 Apr 2024 at 11:53:42
    Re: How to get opened Excel workbook with partial Filename

    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.

     

     

  • VishnuReddy1997 Profile Picture
    2,526 Super User 2025 Season 2 on 30 Apr 2024 at 10:25:22
    Re: How to get opened Excel workbook with partial Filename

    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

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2

Loading started
Loading complete