Home > Excel > Excel file without Excel installed

Excel file without Excel installed

Generating xls/xlsx (or just xml, understandable by Excel) on server-side and returning it to users is a very popular task. At least it is very popular in my career. As usual it is done by automating Excel application. Excel API is well documented, there is a possibility to record a macro in Excel and reproduce VBScript in your own code, so development takes minimum time. The dark sides of such approach are:

  • Need for Excel to be installed on server. Not every customer’s administrator will allow this. Besides of that, you need an Office license, which increases cost of implementation.
  • Rights mess. As soon as Excel is a COM-application, you need to manually allow it to be run remotely.
  • Unstable work. I’m not a great specialist in Excel and don’t clearly know how it was implemented version by version, but it seems to me that even the latest versions hold the dark sins on previous ones.
  • Excel is not designed to work in concurrent users environment. Sometimes two copies of Excel application launched on the server block each other or cause errors.

The option is to make own xml-builder (in case of very simple data-export) or to use one of free open-source libraries. I have experience of building Excel xml from scratch and can say that it is not so complicated if you don’t need something, except plain table, colors, fonts, cells-merging. But it takes much time.

As for libraries, I’d like to tell about two (actually three, but one is improvement of another) of them: EPPlus (improvement of Excel Package) and NPOI. Speaking frankly, first I tried EPPlus, failed and succeeded with NPOI. However, my task was a bit specific, so your results may differ. Main differences between two projects is given in the following table:

Feature EPPlus NPOI
Deployment Single dll, easy to deploy Multiple dlls, sometimes it is hard to understand wich is needed to be deployed
Interface Close to Excel API, very easy to re-write old applications to get rid of Excel interop Specific, not similar to Excel’s
Formats .xlsx only .xls only
Feature set* Wide enough to include some complicated elements in document Basic formatting, basic calculation
Source code/Examples available/available available/available
Documentation Available, but poor Did not find
My own user-experience Easy to develop using EPPlus, errors are understandable and self-descriptive, felt myself like working with Excel interop. However, the result document could not be opened by Excel without restoration, some features (like default column’s width for worksheet) does not work Some time needed for investigation of using library, experience in Excel programming cannot help in development. The result document is in correct format and can be opened with any version of Excel

*I had no time for deep investigation, so this comparison is based on my quick watch. Some features could appear to be implemented, but not noticed by me. You can read about features on each project’s pages on Codeplex.

Hope, this information will help you to start generating Excel files without Excel!

P.S. This is my first post in English, so don’t judge strictly 🙂

Categories: Excel Tags: ,
  1. megafluffles
    12.04.2011 at 09:03

    Thanks for posting this, I found it helpful with researching how to best create spreadsheets on the server for our project.

  2. 30.11.2011 at 07:35

    Actually, NPOI does have document but only in Chinese so far.

  3. 12.02.2014 at 02:35

    Hi, we have developed an API to Generate Excel files Server Side using Automation.
    This may help readers, and we would appreciate feed back.

  1. 05.11.2014 at 23:06

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: