Hey,
I'm working on a project that requires reading information from excel file and for some reason after working for couple weeks without problem I keep getting the same error. I will paste the error at the end of this thread.
I have tried fixing this on my own but nothing seems to work. I have tried the following things:
- Reset the file associations of excel
- Disabled DDE
- Repaired office
- Reinstalled power automate desktop
- restarted my pc (multiple times)
I'm running out of ideas. The file path is correct and I've even tried moving the file into a completely different directory but nothing seems to help. Appreciate any responses and ideas 🙂
Correlation Id: 17dc9034-42dc-44ac-aa74-fd1300cabc4c
Exception has been thrown by the target of an invocation.: Microsoft.PowerPlatform.PowerAutomate.Desktop.Actions.SDK.ActionException: Failed to open Excel document 'C:\Enovia\EnoviaUsageByBusinessAreas\EnoviaUsageByBusinessAreasALL_2406.xlsx
' (File related error). ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException: Sorry, we couldn't find C:\Enovia\EnoviaUsageByBusinessAreas\EnoviaUsageByBusinessAreasALL_2406.xlsx
. Is it possible it was moved, renamed or deleted?
--- End of inner exception stack trace ---
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
at Microsoft.Flow.RPA.Desktop.Modules.Excel.Common.Extensions.ExcelHelper.InvokeMethod(Object object, String methodName, Object[] methodArgs)
at Microsoft.Flow.RPA.Desktop.Modules.Excel.Actions.ExcelActions.<>c__DisplayClass13_0.<LaunchExcel>g__SetActiveWorkbook|1()
at Microsoft.Flow.RPA.Desktop.Modules.Excel.Actions.ExcelActions.LaunchExcel(Variant documentPath, Variant readPassword, Variant writePassword, Variant& excelInstance, Int32 launchMode, Boolean visible, Boolean loadAddInsAndMacros, Boolean needsAuthentication, Boolean readOnly, Boolean launchInNewInstance, String& version)
--- End of inner exception stack trace ---
at Microsoft.Flow.RPA.Desktop.Modules.Excel.Actions.ExcelActions.LaunchExcel(Variant documentPath, Variant readPassword, Variant writePassword, Variant& excelInstance, Int32 launchMode, Boolean visible, Boolean loadAddInsAndMacros, Boolean needsAuthentication, Boolean readOnly, Boolean launchInNewInstance, String& version)
at Microsoft.Flow.RPA.Desktop.Modules.Excel.Actions.LaunchExcel.Execute(ActionContext context)
at Microsoft.Flow.RPA.Desktop.Robin.Engine.Execution.ActionRunner.Run(IActionStatement statement, Dictionary`2 inputArguments, Dictionary`2 outputArguments)
Hey,
Ok this was the issue! I added the "Trim text" action to trim the start and end of the variable produced. I've tried looking at the script manually and it printed the path just fine but I guess what is IT products without some "Features"
Thank you!
Hey,
I use powershell script to get newest file in a folder which I pasted in the end of this reply.
I've tried hardcoding the path in the "launch excel" action and using the variable produced by the powershell script.
I've always taken the path of the file I use by "copy as path" from the file "C:\1\1.xlsx"
Even making a new folder and renaming a copy of the file the issue persists
Powershell script:
$folderPath = "C:\1"
$files = Get-ChildItem -Path $folderPath
$sortedFiles = $files | Sort-Object -Property LastWriteTime -Descending
$newestFile = $sortedFiles[0]
Write-Host "$($newestFile.FullName)"
Rename your Excel file with a simple name such as 1.xlsx or test.xlsx, and place it in a folder (e.g., C:\Excel\1.xlsx). Then, copy and paste the same file name when launching Excel to check if it opens correctly.
Thanks,
Deenuji Loganathan 👩‍💻
Automation Evangelist 🤖
Follow me on LinkedIn 👥
-------------------------------------------------------------------------------------------------------------
If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀
Hi @RikuNie !
If your file is existing, can you do Shift-Right Click and select "Copy as path".
Please paste that destination somewhere in text file and take a screenshot of it and share it here. In this way, we can know whether this file exists, and if it exists maybe in the path something is wrong.
Hey! Thanks for the answer!
I already tried going from C:\temp\enovia\... to C:\Enovia\... but it still doesn't seem to work. Using the run application gives similar error as launch excel. I'll probably need to sleep on it and try again tomorrow as this doesn't make much sense why it isn't working. I can open the file in question without problems manually in excel.
I have a feeling that this might even be just a typo somewhere which I cannot spot.
Can you take a screenshot of the %PowershellOutput% -variables value when the flow has gone to error. I would assume there is something wrong about that even though it may not look like it at first.
Maybe try using Trim -action to that variable so to trim empty spaces around it (sometimes script outputs can return emptyrows after the value that it returns)
I have it as a variable which I get through powershell script. I have tried making a copy of the file in question and hardcoding the filename into the action but neither works. Someone had fixed it by putting the file extension behind the variable but that doesn't work either.
Check your file name as @eetuRobo mentioned in his above response.
Other workarounds:
1. Simply copy and paste the same file, or any other Excel file, into a straightforward folder structure. For example, create a new folder in the root of the C drive named 'excel' and place your Excel file there. Then, you can directly open your Excel file using the file browser as previously @eetuRobo mentioned.
2. Use "Open Application" and mention exe path with excel file path like below:
Thanks,
Deenuji Loganathan 👩‍💻
Automation Evangelist 🤖
Follow me on LinkedIn 👥
-------------------------------------------------------------------------------------------------------------
If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀
How have you put the filepath to the Launch Excel? Is it variable or hard coded path?
Try just manually taking it for troubleshooting (even if it would need to be dynamic in your flow):
One thing that comes to mind is that your file seems to have been named as a date:
C:\Enovia\EnoviaUsageByBusinessAreas\EnoviaUsageByBusinessAreasALL_2406.xlsx
Are you sure it hasn't changed to end 2706 or something if there is some other automation/integration that uses/names the file?
eetuRobo
62
Super User 2025 Season 1
Nived_Nambiar
18
Super User 2025 Season 1
CU12050101-0
12