Question

Error message: An unknown error occurred while trying to write a data table to a worksheet

  • 23 February 2023
  • 1 reply
  • 296 views

Badge +3

Hi Team,

In my new robot, bot creates new excel file (.xlsx format) in a local folder (Documents folder) and then it should write a data table inside this excel file. 

In attended mode everything works as expected.

In unatteded mode I’m getting this error:

“An unknown error occurred while trying to write a data table to a worksheet”

Do you have any idea what may cause such issue?

Many thanks for helping! 


1 reply

Userlevel 5
Badge +10

@Kasia 8214 

Cause

Cause 1: Excel installation was corrupt at the OS level, an indication is that when right-clicking anywhere and on New >, Microsoft Excel Worksheet was not displayed

111.jpg

Cause 2: Issue is observed after the upgrade of either Control Room or Excel, the Package version is not set to Default

Cause 3: Issue is observed after windows patch is installed and excel DLLs are corrupted because of which A360 is unable to connect with excel, but we are able to create/open excel files manually.

Cause 4: old Office installation registry settings remains active on system. Bot_Launcher log show the exception below.

ERROR [BotRunner-6a1551e8-b77c-44bc-8c84-322f7225f7b8_f01d1a725e302d15] - com.jniwrapper.win32.jexcel.Application {deploymentId=6a1551e8-b77c-44bc-8c84-322f7225f7b8_f01d1a725e302d15, traceId=f01d1a725e302d15} - error(SourceFile:69) - java.lang.reflect.InvocationTargetException: nullCaused by: com.jniwrapper.win32.com.ComException: COM object method returns error code: 0x80029C4A; Error loading type library/DLL.

Resolution/Workaround

Solution 1: Re-install Excel, then the "New > Microsoft Excel Worksheet" command appears, and the bot will run successfully.

222.jpg

Solution 2: Please set the default version for the Excel Advanced package.

Solution 3: Need to perform the online repair of office:-
Click Start, and then click Control Panel. Double-click Programs and Features. Click Microsoft Office 365, and then click Change. Select Online Repair, and then click Repair

image.png


Solution 4: need to install Office after using 'Office uninstall support tool'
  1. adjust and use commands below on Powershell to confirm if same exception appears;

$file = "D:\CSV\Dummy.xlsx" #change path accordingly$sheetName = "Sheet1"$excel = New-Object -com Excel.Application$excel.Visible = $True$wb = $excel.workbooks.open($file)

  2. exception 'Unable to cast COM object[...]' will appear during execution if old settings are still available;
  3. uninstall Office using Microsoft utility available on 'option 2' from URL below;

https://support.microsoft.com/en-us/office/uninstall-office-from-a-pc-9dd49b83-264a-477a-8fcc-2fdf5dbf61d8

  4. reboot device;
  5. install Microsoft Office.

Reply