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?
Thank you so much!
This flow works perfectly!
Hi @Sormick ,
To focus the excel file use Focus window action as mentioned below.
I have created the similar flow.Please find the solution
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
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:
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?
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
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.
(Note:- if you got your solution you can mark as solution and gives kudos)
Thanks & Regards
Vishnu Reddy
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!
Hello @VishnuReddy1997 ,
Sorry but i'm using the French version of Power app.
Please find my screenshot below
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.
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.
(Note:- if you got your solution you can mark as solution and gives kudos)
Thanks & Regards
Vishnu Reddy
Tomac
986
Moderator
stampcoin
699
Super User 2025 Season 2
Riyaz_riz11
577
Super User 2025 Season 2