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.
5,576 questions
Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
2,175 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,874 questions
{count} votes

Accepted answer
  1. Mike Urnun 9,856 Reputation points Microsoft Employee
    2023-09-29T00:04:10.8166667+00:00

    Hello @Mugileeshwaran J S - Unfortunately, as far as Azure Functions, this doesn't seem possible: https://feedback.azure.com/d365community/idea/564859b0-f224-ec11-b6e6-000d3a4f0da0

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Ben Gimblett 4,550 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


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.