So I really can’t use Excel Object Model to be used server-side?

I’m trying to develop a c#/ application to extract data from a SQL server and have it formatted in an excel spreadsheet. I have been practicing with excel object model and recently stumbled upon this: Considerations for server-side Automation of Office

From what I understand I really can’t use Excel Object models? And if not what are other solutions/advice besides whats suggested in this article and 3rd party apps I can use?


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

From that article:

Microsoft does not currently recommend, and does not support,
Automation of Microsoft Office applications from any unattended,
non-interactive client application or component (including ASP,
ASP.NET, DCOM, and NT Services), because Office may exhibit unstable
behavior and/or deadlock when Office is run in this environment.

What this means is that Microsoft won’t explicitly prevent you from trying (the licensing allows you to try.) However, if there is a problem, it’s up to you to figure out how to fix it.

There is a better option:

Create Excel (.XLS and .XLSX) file from C#

This will allow you to create the file for download without having to use Excel automation on the server side.

Method 2

I can recommend the SpreadsheetGear library, it has all the Excel functions in one managed dll:

Method 3

You ‘can’ use Excel automation on the server side. However you will be breaching licences ,may run into security problems and generally experience other odd behaviour, especially if you have more than one user using it at a time. I would suggest that you dont do it.

  1. If the data you want to write is simple enough just do it as a csv
  2. If not and you really have to write a spreadsheet look for a 3rd
    party component that writes excel files. I only know of one off
    top of my head and thats Aspose.Cells, but that is quite

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x