How can i fix the error:"Excel Application Scope: Failed opening the Excel file. Possible reasons: the file is corrupt, the file is already used by another process or you don't have permissions to open the file." My Excel automation fails with:"Failed opening the Excel file. Possible reasons : the file is corrupt, the file is already used by another process or you don't have permissions to open the file."
Root Cause
When running Background Automations via Unattended Robots, using Microsoft Office applications such as Word, Excel or PowerPoint might not work properly as they have been built to run in User-Session, meaning that they need an interactive desktop session and user profile.
Resolution
To solve this, try either of the below approaches.
- Use either "Start Process" or "Open Application" as activities in the project before the other activities that work with the Excel File. This ensures that the Excel process is running before the Excel automation starts.
- If another user is opening the same Excel file the automation is using, close their session and keep open only the Robot's session.
- If enabled, disable the "Starts in Background" setting from the General Project Settings menu from UiPath Studio.
For additional information on how Office 365 Products work with Server Sessions(session 0), see the Server-side Automation of Office document from Microsoft.