Excel File getting corrupted

UiPath team,

I have Bot deployed to carry checklist process and it was working fine for months. But in last few weeks the checklist excel sheet and the config sheet is getting corrupted. I fixed by replacing a new sheet but again the same error occurred and sheets were corrupted.

Is this due to lack of UiPath.Excel.Activities package update. As the process had version 2.4 and latest one is 2.5.2.

Hi @Rajasegar94

Is it possible that you have experienced either of the following scenarios

  • using a write cell activity on an Excel file that contains a comment in one of the cells
  • using a write range activiy on an Excel file that is saved with some filtering (=not all cells are visible)

I think there are two bugs that can cause weird behaviours in those circumstances.

2 Likes

There is no comments or filtering in the excel. But as it is checklist excel, Column get added on daily basis.

Lately often, The process fails often throwing the below exception in Read range activity and checklist file get corrupted.

System.InvalidOperationException: Specified part does not exist in the package. at UiPath.Executor.WorkflowRunner.EndExecute(IAsyncResult result) at UiPath.Core.Activities.InvokeWorkflowFile.EndExecute(AsyncCodeActivityContext context, IAsyncResult result) at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result) at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

When I use new checklist file process works fine but after few days the same error occur.

May be the Write range activity used in the end of the process is corrupting the excel file. So the Read range activity fails in the next run. Is there solution to it or some thing I could avoid in the excel file to overcome this issue.

Note: The process was working fine for months till the latest version(9.3.0) update.

Hi @Rajasegar94

Just a Suggestion.

Try killing Excel before starting the new transaction.

Sivapradeep,
I am using Workbook- Read range. And in fact no Excel is installed in the Bot machine to kill the process.

@loginerror,

Do you have any update on this issue.

@loginerror,

Is the issue fixed in the latest version? Since the Excel sheet in many business scenarios has comments or Filters.

One fix is to use Excel scope activity instead of Workbook. But it needs Excel license in the runtime machine which is separate cost.

Hi @Rajasegar94 is this resolved??
I am also facing the same issue and it would be great if you can provide me with the solution

1 Like

Am also getting the same error please help me
20.4.3

Source: Read Range

Message: File contains corrupted data.

Exception Type: System.IO.FileFormatException

RemoteException wrapping System.IO.FileFormatException: File contains corrupted data.
at MS.Internal.IO.Zip.ZipIOEndOfCentralDirectoryBlock.FindPosition(Stream archiveStream)
at MS.Internal.IO.Zip.ZipIOEndOfCentralDirectoryBlock.SeekableLoad(ZipIOBlockManager blockManager)
at MS.Internal.IO.Zip.ZipArchive…ctor(Stream archiveStream, FileMode mode, FileAccess access, Boolean streaming, Boolean ownStream)
at MS.Internal.IO.Zip.ZipArchive.OpenOnFile(String path, FileMode mode, FileAccess access, FileShare share, Boolean streaming)
at System.IO.Packaging.ZipPackage…ctor(String path, FileMode mode, FileAccess access, FileShare share, Boolean streaming)
at System.IO.Packaging.Package.Open(String path, FileMode packageMode, FileAccess packageAccess, FileShare packageShare, Boolean streaming)
at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.OpenCore(String path, Boolean readWriteMode)
at DocumentFormat.OpenXml.Packaging.SpreadsheetDocument.Open(String path, Boolean isEditable, OpenSettings openSettings)
at ClosedXML.Excel.XLWorkbook.LoadSheets(String fileName) in C:\Projects\ClosedXML\ClosedXML\Excel\XLWorkbook_Load.cs:line 44
at UiPath.Excel.WorkbookFile…ctor(String workbookPath, String password, Boolean createNew)
at UiPath.Excel.Activities.WorkbookActivity1.ConstructWorkbook(String path, String password, Boolean createNew) at UiPath.Excel.Activities.WorkbookActivity1.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)

1 Like

Hi,
If u got the solution of above error , pls share.
I am also facing the same issue

Hi,

If excel is installed in ur bot machine then use Excel scope activities instead of workbook. if not make sure the excel has no comments, hide or filters applied in the excel.

And have regular practice of replacing new excel if the sheet is overloaded with data.

hi have any solution? I am facing the same issue!!!

Hi,
Potential solution is to save the workbook with “Save Workbook” activity. This may fix the corrupted data. Unfortunately the activity will work only if you have installed excel on the machine.
Please let me know, if there is another way, without using Application Scope.

hello @remm
I have facing same error when file have corrupted and error have got “Write Range: Specified part does not exist in the package.” please give me some ideas so how to resolve it

thanks

Hello @zaid.ahmad , Did you tried with the Write range workbook activity instead of the Excel application scope-based activities?

@Gokul_Jayakumar Hello,
Yes i have tried write range WB activity