-1

I am getting the COMException when importing data from Excel file. Now my application uses Microsoft.Office.Interop.Excel NuGet package but it referenced the dll in GAC and this dll didn't get into the bin when publishing the files. So I manually reference to the dll in packages folder and then published the web app. Even then the dll didn't get published. What I observe is while the other dlls from Nuget packages have Copy Local set to True, the Microsoft.Office.Interop.Excel dll has False and I am nnot able to change it either. I read a few articles suggesting installing the Excel dlls on server, I am wondering how does the Nuget package help in this case?

Do I need to install Excel Interop dlls on server? If yes, whats the point of providing the Nuget for it?

Jordan J
  • 21
  • 3
  • 2
    A missing DLL does not produce a COMException. Guessing is not useful, you have to quote the message to get help. After checking that Office is actually installed on that machine, by far the most common oversight. – Hans Passant Jan 10 '20 at 16:31
  • Thanks Hans. Yes, you are right about COMException. I meant any Excel setup not just dll. – Jordan J Jan 13 '20 at 18:11

1 Answers1

0

Microsoft.Office.Interop.Excel requires Excel itself (not just the DLLs) to be installed on the machine where the application is running. In instances where you cannot control this, use a document library like EPPlus or ClosedXml.

Heck, even use them when Excel IS installed on the machine. They require far less overhead.

Nathan Miller
  • 785
  • 4
  • 11
  • Thanks Nathan. I observed that the web server had Excel installed. I used EPPlus as suggested by you to remove the need to install Excel. It works!! Thanks. – Jordan J Jan 13 '20 at 18:12