Share via

Excel Interop/DCOM to OpenXml/EPPlus

Alain PAPET 20 Reputation points
2026-06-04T16:18:44.83+00:00

Hi,

In our server side application, clients can upload .xlsm files (after they modified a macro).

Then the server is using these .xslm as a model to create new file, add data in sheets and run the macro.

(server is doing that as jobs at night because macros are big).

Until now, we were using Excel Interop/DCOM to manage the Excel files.

But it is no longer recommended.

Its better to use OpenXml, EPPlus or any other third-party library to modify Excel file.

Unfortunately, only Excel Interop/DCOM can open the files and run the macro.

I would like to know if someone already had this problem and if there is any solution ?

Thanks for your help.

Alain.

P.S. : re-coding macros using OpenXml seems difficult as each client modify its own macro.

Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.


Answer accepted by question author

Danny Nguyen (WICLOUD CORPORATION) 7,105 Reputation points Microsoft External Staff Moderator
2026-06-05T03:53:54.7633333+00:00

Hi @Alain PAPET ,

Yes, this is a known limitation with server-side Office automation. Microsoft does not recommend or support automating Office applications from unattended/server-side code such as ASP, ASP.NET, DCOM, or Windows services.

Reference: Considerations for server-side Automation of Office

The document explains that Office applications are designed for interactive desktop use and may become unstable or deadlock when used in a server-side environment. It also highlights the security risk of opening uploaded files and running macros on the server, especially because macros could run with high privileges depending on the server context.

Because of that, I would generally avoid a design where customer-uploaded .xlsm files are opened and their VBA macros are executed on the server. Open XML/EPPlus can help with reading or modifying workbook data, but they are not a supported replacement for running VBA macros.

A safer approach would be to move the processing logic outside Excel, or redesign the flow so macro execution happens client-side or in a controlled/isolated environment.

Hope this helps. If you found my response helpful or informative, I would greatly appreciate it if you could follow this guidance or provide feedback.

Thank you.

Was this answer helpful?

1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

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