Search code examples
exceloffice-interop

How many excel process i can invoke using c#


I have an application (web) which suppose to open separate excel process for each session. When i try this, server opened only 20 process, is it a restriction or is their a way to open more than 20 Excel.exe process.

Thanks


Solution

  • I think this depends on your system resources.

    However I can tell you from personal experience that Excel Interop is not a recommended solution to web applications e.g. C# ASP.NET. See here even: https://support.microsoft.com/kb/257757?wa=wsignin1.0

    Why else?:

    1. Excel Interop uses a lot of system resources and your web application will soon run into many performance issues.

    2. Excel Interop has to be installed on the server and there are also issues with the process identity. Installation and configuration is sometimes hard and differes for 32 bit and 64 bit systems.

    3. Sometimes for, God knows what, reasons Excel Interop processes will not close immediately (not only if some Interop resources are unreleased). Then you will have to close these processes yourself which is a real pain.

    Why not use OpenXML or even better ClosedXML? You will see your code running even 100x faster with Excel files as OpenXML/ClosedXML treats Excel files as XML files and does not create additional processes for intermediary operations.

    CloseXML link: https://closedxml.codeplex.com/