Read Range: Root element is missing

Hi everyone,
I’m trying to write a cell in an exce file, with the workbook activitys because we don’t have office license, but i get the next errors
The first run after I configured the activity write cell

Source: Write Cell

Message: The given key was not present in the dictionary.

Exception Type: System.Collections.Generic.KeyNotFoundException

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at UiPath.Excel.Activities.WorkbookActivity`1.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)

and later in every subsequence run that i do

Source: Read Range

Message: Root element is missing.

Exception Type: System.Xml.XmlException

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.Xml.XmlException: Root element is missing.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
at ClosedXML.Excel.XDocumentExtensions.Load(Stream stream) in C:\Projects\ClosedXML\ClosedXML\Extensions.cs:line 299
at ClosedXML.Excel.XLWorkbook.GetCommentVmlFile(WorksheetPart wsPart) in C:\Projects\ClosedXML\ClosedXML\Excel\XLWorkbook_Load.cs:line 623
at ClosedXML.Excel.XLWorkbook.LoadSpreadsheetDocument(SpreadsheetDocument dSpreadsheet) in C:\Projects\ClosedXML\ClosedXML\Excel\XLWorkbook_Load.cs:line 340
at ClosedXML.Excel.XLWorkbook.LoadSheets(String fileName) in C:\Projects\ClosedXML\ClosedXML\Excel\XLWorkbook_Load.cs:line 45
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)

I know that the problem is with the excel file. Originally the file was a .xlsm but I changed this extension to .xlsx because again we don’t have an office license

1 Like

Hi welcome to the community!
Well i guess then, you already know what might be the problem there :slight_smile:
You can google for converting this, instead of just renaming the extension…

@Sebastian_David_Jime I am also facing the same issue with workbook- write cell activity. Did you resolve it?

Hello Arpit

I have encounted same issue (Root element is missing) when I using the workbook-Read Range for a .xlsm file, then I found that defualt format is .xlsx/.xls

I guessed that may this is where the issue comes from

then I tried Excel Application Scope+Excel-Read Range, and it works

May you can try