I want to run the powershell in Azure function as http trigger, where powershell script has function to open the excel and to read it, while trying to open it it displays the below error

Mugileeshwaran J S 20 Reputation points
2023-08-31T06:06:49.5533333+00:00

Retrieving the COM class factory for component with CLSID {00000000-0000-0000-0000-000000000000} failed due to the following error: 80040154 Class not registered (0x80040154 (REGDB_E_CLASSNOTREG)).
2023-08-10T10:29:06Z

 

Register COM Object

I also tried placing the dll file in the location and tried to run, but same error
User's image

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,679 questions
Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
1,694 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,329 questions
{count} votes

1 additional answer

Sort by: Most helpful
  1. Ben Gimblett 3,845 Reputation points Microsoft Employee
    2023-09-15T13:26:20.3533333+00:00

    Generally speaking COM isn't supported in App Service / Functions due to the sandbox that your code runs in

    An almost identical Q&A on this (and trying to access Excel) is here https://learn.microsoft.com/en-us/answers/questions/247908/how-to-register-microsoft-component-object-model-i

    App Service supports windows containers (as well as AKS), but as far as I know windows containers aren't supported yet by Functions. They are also not supported yet on Container Apps.

    So you could host an API in App Service on a windows container - this would give much more access to the guest OS and should unblock you here