How to Hresult error in excel.. even after using kill process excel this error comes

how to fix the below error permanently

UiPath.Excel.ExcelException: Failed setting the current sheet to: sheet5 in workbook: D:\OneDrive - Hemas Enterprises pvt Ltd\Desktop\Logic.xlsx. Original error message: Exception from HRESULT: 0x800AC472 β€”> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800AC472 at Microsoft.Office.Interop.Excel._Worksheet.Activate()
at UiPath.Excel.WorkbookApplication.SetSheet(String sheetName, Boolean createNew)
β€” End of inner exception stack trace β€”
at UiPath.Excel.WorkbookApplication.SetSheet(String sheetName, Boolean createNew)
at UiPath.Excel.Activities.ExcelInteropActivity`1.BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, Object state)
at System.Activities.AsyncCodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

Hello @sathish_Kumar6

  1. Close Background Processes: Close any running Excel processes and try again.
  2. Update/Repair Office: Update or repair your Microsoft Office installation.
  3. Run as Administrator: Run both UiPath and your process as an administrator.
  4. Check Names and Paths: Verify accurate workbook and sheet names, and ensure the file path is correct.
  5. Update UiPath: Use the latest UiPath version and Excel activities.

Thanks & Cheers!!!

1 Like

Hey @sathish_Kumar6 ,

It looks that the file is shared over the one drive and someone else has opened the file while you are trying to edit it, make sure the file is closed before using it.


1 Like

yes actually thats what i thought its linked to onedrive so changing the path normal instead of onedrive means it will be ok right?

Thanks for the suggestions

If you don’t need to edit the original file, you could copy it to a local folder (with the Copy File activity) then use that file in your automation.