I have created a module that is downloading a data export in .xls (97-2003 format) from a webpage. The file is loaded into a data table and updated. This part is working fine.
However I need to write back to the downloaded file. I am using the UiPath.Excel.Activities.WriteCell activity that does not require an Excel Application Scope. But apparently only one cell is written and then this error is thrown:
Message: Unexpected record type (DimensionsRecord)
Exception Type: System.InvalidOperationException
From what it seems it might be caused by the fact that the file is downloaded from the web. The standard in Excel (running O365) is to show a security warning whenever opening a file from the web.
In the Trust Center under Protected View I have disabled all settings. Additionally I have added the file path to Trusted Locations.
But still only the first cell is written. I have then opened the Excel file and added a blank space in one of the cells in order to be able to save the file. And then it is possible to run the code without any errors.
For some reason it seems that the “Protected View” is still in function blocking for UiPath to update the file. What I do not understand is why it can write one cell and not the rest (?)
If using an Excel Application Scope it runs without any problems even though the file has not been modified with a blank space after the download. But this is not an option since Excel will not be installed on the machine running the robot.