Building custom solutions that extend, automate, and integrate Microsoft 365 apps.
Hi Abhishek,
Welcome to the Microsoft Q&A forum.Thank you for sharing the detailed information.
Based on your description, I understand that the issue only occurs when Excel is automated through a non-interactive session (SSH > PowerShell) and does not occur when the same script is executed in a direct interactive user session.
This suggests that the root cause may be related to Office automation in an unattended environment, rather than the workbook file itself.
At this time, we have not identified any publicly documented known issue specific to Excel build 16.0.20228.20186 that causes the RPC_E_CALL_REJECTED error or results in a crash of mso98win32client.dll.
To further investigate the issue, could you please help check the following:
1/ Run the same script in an interactive RDP session
Instead of executing the script through SSH, please try running the same script within an interactive Remote Desktop (RDP) session and verify whether the issue still occurs.
2/ Test with a different workbook
Please create a new workbook containing only a few cells of simple data, then run the script again and check whether the issue persists.
3/ Disable all Excel add-ins
Please try disabling all Excel add-ins to rule out the possibility of an add-in conflict causing the issue.
Once you have completed the steps above, please let me know the results so that I can continue assisting you and recommend more appropriate troubleshooting measures.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.