Hello Community,
When running a flow in Power Automate Cloud, with "Run a flow built with for Power Automate Desktop" it gives me the following error,
Problem executing the "LaunchAndOpenUnderExistingProcess" action. Could not open Excel document ".xls" (Error related to a file).
Microsoft.Flow.RPA.Desktop.Modules.SDK.ActionException: Could not open Excel document ".xls" (File related error). ---> System.IO.FileNotFoundException: documentPathSafe
at Microsoft.Flow.RPA.Desktop.Modules.Excel.Actions.ExcelActions.<>c__DisplayClass10_0.<LaunchExcel>g__SetActiveWorkbook|1()
at Microsoft.Flow.RPA.Desktop.Modules.Excel.Actions.ExcelActions.LaunchExcel(Variant documentPath, Variant varPassword, Variant& excelInstance, Int32 launchMode, Boolean visible, Boolean loadAddInsAndMacros, Boolean needsAuthentication, Boolean readOnly, Boolean launchInNewInstance)
--- End of inner exception stack trace ---
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)
How can I solve that?
But when running in Power Automate Desktop, it runs fine.
.
With the help of CurrentItem you can use the File Path part
In the below toggle buttons, either enable filename or filenamenoextension as per your requirements.
Hi @VJR,
I used "Get part of a file path"
How can I "Get part of a file path"?, because every time I download the file it changes its name. When selecting the "Get files from the folder" variable, it is not supported because it is "List of Files" and complementing it with a Range Number in Power Automate Cloud generates problems.
When I run flow in Power Automate Desktop, everything runs fine.
Instead of line #4, if you want to get the file name with/without extension then use Get file path part.
Hi @VJR,
I leave images of the flow in the language, in order to help understand.
I did not understand the last two recommendations that you pointed out to me.
If you can help me with that.
It is clear from the error that somewhere the file name variable is not getting initialised and therefore it is not printing the full file name in the below error. It is inly printing the extension as seen below.
Error: Could not open Excel document ".xls" (Error related to a file).
System.IO.FileNotFoundException
It is hard for me to diagnose and that too in a different language.
- Check what parameters are you passing from the cloud flows.
- For testing purpose add the default values to these parameters within Desktop flow and run it and test it that way.
In line #3 I get Excel file in .xls
In line #6 I open an Excel file in .xls and then in line #7 I close and save as .xlsx. I save the Excel file in .xlsx to filter items with SQL.
In line #8 I delete Excel .xls file to empty the folder.
But may I know why these are different?
Hi @VJR,
Add Message Box and it runs fine in Power Automate Desktop, but running in the Cloud gives me the same error.
Problem executing the "LaunchAndOpenUnderExistingProcess" action. Could not open Excel document ".xls" (Error related to a file).
Microsoft.Flow.RPA.Desktop.Modules.SDK.ActionException: Could not open Excel document ".xls" (File related error). ---> System.IO.FileNotFoundException: documentPathSafe
at Microsoft.Flow.RPA.Desktop.Modules.Excel.Actions.ExcelActions.<>c__DisplayClass10_0.<LaunchExcel>g__SetActiveWorkbook|1()
at Microsoft.Flow.RPA.Desktop.Modules.Excel.Actions.ExcelActions.LaunchExcel(Variant documentPath, Variant varPassword, Variant& excelInstance, Int32 launchMode, Boolean visible, Boolean loadAddInsAndMacros, Boolean needsAuthentication, Boolean readOnly, Boolean launchInNewInstance)
--- End of inner exception stack trace ---
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)
Yes, on line #6 it shows .xls, but on line #8 it is disabled, now delete line #8.
I get the file as .xls and then save it as .xlsx so I can run SQL
How can I solve that?
For testing purposes,
Above line #6, add Display box and show the %CroppedText% variable.
Then run the process from the Cloud Flows
Check what the Display box shows. Does the show the correct excel file or incorrect?
One more thing,
In line #6 it shows .xls
in line #8 it is .xlsx
Which extension is correct? - .xls or .xlsx?