Skip to main content

Notifications

Community site session details

Community site session details

Session Id : OTFDmaO+5rcEfm96k/Rrke
Power Automate - Power Automate Desktop
Unanswered

Power automate desktop - Failed to open excel document (File related error)

Like (0) ShareShare
ReportReport
Posted on 27 Jun 2024 11:29:31 by 16

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)

Categories:
  • RikuNie Profile Picture
    16 on 04 Jul 2024 at 06:03:39
    Re: Power automate desktop - Failed to open excel document (File related error)

    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!

    RikuNie_0-1720072927092.png

     

  • RikuNie Profile Picture
    16 on 04 Jul 2024 at 05:56:10
    Re: Power automate desktop - Failed to open excel document (File related error)

    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)"

  • Deenuji_Loganathan_ Profile Picture
    6,105 Super User 2025 Season 1 on 27 Jun 2024 at 14:56:05
    Re: Power automate desktop - Failed to open excel document (File related error)

    @RikuNie 

     

    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 🚀

  • NathanAlvares24 Profile Picture
    1,673 Super User 2025 Season 1 on 27 Jun 2024 at 14:10:41
    Re: Power automate desktop - Failed to open excel document (File related error)

    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.

  • RikuNie Profile Picture
    16 on 27 Jun 2024 at 13:24:04
    Re: Power automate desktop - Failed to open excel document (File related error)

    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.

    RikuNie_1-1719494190665.png

    RikuNie_3-1719494313254.png

     

     

  • eetuRobo Profile Picture
    3,245 Super User 2025 Season 1 on 27 Jun 2024 at 13:22:42
    Re: Power automate desktop - Failed to open excel document (File related error)

    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)

  • RikuNie Profile Picture
    16 on 27 Jun 2024 at 13:12:39
    Re: Power automate desktop - Failed to open excel document (File related error)

    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.

    RikuNie_0-1719493890761.png

     

  • Deenuji_Loganathan_ Profile Picture
    6,105 Super User 2025 Season 1 on 27 Jun 2024 at 12:58:46
    Re: Power automate desktop - Failed to open excel document (File related error)

    @RikuNie 

     

    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:

    Deenuji_0-1719493115603.png

     

     


    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 🚀

     

     

  • eetuRobo Profile Picture
    3,245 Super User 2025 Season 1 on 27 Jun 2024 at 12:23:29
    Re: Power automate desktop - Failed to open excel document (File related error)

    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):

    eetuRobo_0-1719490892598.png


    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?

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,670 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard
Loading started