Skip to main content

Introduction

  • The core library project can be found on GitHub, where the latest source versions are hosted.
  • For general questions and discussion about Excel-DNA, use the Google group or Stack Overflow.
  • Specific issues, bug reports and feature requests can be added to the GitHub Issues list.
  • For more about Excel-DNA, see the introductory information below, and the searchable (back to February 2007) Google group history.
  • For a permanent bookmark to the project, use the Excel-DNA home page at http://excel-dna.net.

Overview

Excel-DNA is an independent project to integrate .NET into Excel. We hope it will be useful to Excel users who currently write VBA code for functions and macros, and would like to start using .NET. Also interested would be C/C++ based .xll add-in developers who want to use the .NET framework to develop their add-ins.

(For a bit more background about .NET and Excel-DNA, see What and why? - An introduction to .NET and Excel-DNA.

The Excel-DNA Runtime is free for all use, and distributed under a permissive open-source license that also allows commercial use.

Excel-DNA is developed using .NET, and users have to install the freely available .NET Framework runtime. The integration is by an Excel Add-In (.xll) that exposes .NET code to Excel. The user code can be in text-based (.dna) script files (C#, Visual Basic or F#), or compiled .NET libraries (.dll). Excel-DNA supports both the .NET runtime version 2.0 (which is used by .NET versions 2.0, 3.0 and 3.5) and version 4. Add-ins can target either version of the runtime, and concurrent loading of both runtime versions into an Excel instance is supported.

Excel versions '97 through 2016 can be targeted with a single add-in. Advanced Excel features are supported, including multi-threaded recalculation (Excel 2007 and later), registration-free RTD servers (Excel 2002 and later) and customized Ribbon interfaces (Excel 2007 and 2010). There is support for integrated Custom Task Panes (Excel 2007 and later), offloading UDF computations to a Windows HPC cluster (Excel 2010 and later), and for the 64-bit versions of Excel 2010 and 2013.

Most managed UDF assemblies developed for Excel Services can be exposed to the Excel client with no modification. (Please contact us if you are interested in this feature)

The latest release - Excel-DNA Latest - includes support for both RTD-based asynchronous worksheet functions (Excel 2002 and later) and native Excel asynchronous functions (Excel 2010 and later). The RTD-based asynchronous support is designed to (optionally) integrate with the .NET 4.0 Task-based operations, as well as the Reactive Extensions library, allowing IObservables to be exposed as 'live' worksheet UDFs - (thus 'RxExcel'). The language-specific support for asynchronous functions in C# 5, Visual Basic 11 and F# 2.0 can be easily integrated with the Excel-DNA asynchronous interfaces.

Are there no other ways to create Excel add-ins with .NET? Why should I use Excel-DNA?

There are a few different ways of making Excel add-ins with .NET, but Excel-DNA has unique advantages. For starters, these are the different kinds of Excel add-ins that can be created with .NET:

  • VSTO
  • COM add-in
  • C API
  • Other libraries (e.g. NetOffice, Add-In Express, FCell)

Where does Excel-DNA fit in?

Excel-DNA brings together all three parts that are needed to make a great Excel add-in with .NET - the native Excel C API, the COM object model and the .NET runtime.

Should I not just stick to the official Microsoft tools for making Excel add-ins, rather than relying on a third-party tool?

Using only Microsoft's tools makes it hard to create powerful and full-featured Excel add-ins with .NET that work in different Excel versions, and that are easy to deploy. Some of the problems are:

  • Microsoft has no official support for using the native Excel C API in .NET add-ins
  • VSTO has no support for making user-defined worksheet functions
  • Automation add-ins can provide UDF, but have poor performance, and allow limited customization
  • VSTO and regular COM-based add-ins require administrative rights to install

What if I want to make an Excel add-in with Python, C or C++?

Excel-DNA is used for making Excel add-ins with .NET. For alternative programming languages, there are similar libraries that integrate with the native Excel C API, such as:

  • Python: PyXLL
  • C/C++: Xlw, XLL+
  • Modern C++: xll8.

What about VBA? Can Excel-DNA help me use my current VBA skills and still move to .NET?

VB.NET is the newest member of the Visual Basic family. While sometimes overshadowed in popularity by C#, VB.NET is as powerful as C# (sometimes more!), can access all the same .NET libraries, and is fully supported for making Excel-DNA add-ins. Using VB.NET gives a degree of familiar syntax for those who are coming from VBA, requiring a gradual learning curve to get used to the few existing differences. However, rest assured that VB.NET provides access to the full power of .NET and Excel-DNA.

Excel-DNA add-ins can also integrate with VBA code by creating custom COM libraries that can be called from VBA. One advantage in putting these libraries inside an Excel-DNA add-in is that they can be deployed without requiring registration with administrator privileges.

The home page for Excel-DNA is at http://www.excel-dna.net.

The documentation is still sparse, but if you need any help, try the main Excel-DNA support forum on Google Groups, https://groups.google.com/group/exceldna, where an extensive history of discussions can be found and searched through.

You are also welcome to contact us with questions, comments or suggestions.

How To's

Samples

Various sample projects and snippets related to Excel-DNA are available in the Samples repository.

Excel-DNA Extension Projects

  • ExcelDnaDoc provides tools to make help generation easier.
  • Registration allows the automatic generation of parameter and function conversions, removing boiler-plate code for optional parameters, async functions etc.
  • IntelliSense add in-sheet IntelliSense for Excel UDFs.

Community Projects

If you are a VBA developer interested in moving to .NET, you should start with Patrick O'Beirne's detailed VBA to Excel-DNA migration guide.

Various Samples and Tutorials

Various F# Examples

External projects using Excel-DNA

Support

There is a searchable record of more than 5000 messages on the Excel-DNA Google Group.

There are many questions answered on Stack Overflow under the tag excel-dna.

Please don't hesitate to ask. If you are stuck or need some help using Excel-DNA your questions really are very welcome - whether you are just getting started, or an Excel-DNA expert.

And if you could help put together some proper documentation, please contact me. We'd be happy to add you as an editor in this repository.

  • NetOffice is a set of version-independent assemblies to allow Office integration through the COM automation interface. The NetOffice libraries can be used from an Excel-DNA add-in to ease version-independent Excel add-in development, and ease compatibility with VBA.
  • Visual Studio Tools for Office (VSTO) is Microsoft's preferred plan for integrating .NET with Office. It is mainly aimed at making it easy for Visual Studio developers to create solutions integrated with the Office applications. In contrast, Excel-DNA is (eventually) aimed at Excel end-users, as a compelling replacement for VBA, completely independent of Visual Studio.
  • Add-in Express is a commercial alternative to VSTO for users with Visual Studio. It support making add-ins for the various Office products, not just Excel, and has helpful wizards and graphics designers.
  • Jens Thiel's ManagedXll was an established, commercial product to easily create .xll libraries in .NET. If ManagedXll were free, Excel-DNA would not exist.
  • Statfactory's NeXL are F# based connectors to get data from various platforms (Bloomberg, Quandl, Worldbank, IMF and the R language) into Excel.
  • For making Excel Add-Ins in Python, have a look at PyXLL.
  • There are a number of C/C++ libraries and tools that make creating .xlls easier than using the Excel SDK directly:

Performance

Information about the performance of Excel-DNA user-defined functions can be found on the Excel-DNA Performance page.

More Details

Excel-DNA is developed using .NET, and users have to install the freely available .NET Framework runtime. The integration is by an Excel Add-In (.xll) that exposes .NET code to Excel. The user code can be in text-based (.dna) script files (C#, Visual Basic or F#), or compiled .NET libraries (.dll). Excel-DNA supports both the .NET runtime version 2.0 (which is used by .NET versions 2.0, 3.0 and 3.5) and version 4. Add-ins can target either version of the runtime, and concurrent loading of both runtime versions into an Excel instance is supported.

Excel versions '97 through 2016 can be targeted with a single add-in. Advanced Excel features are supported, including multi-threaded recalculation (Excel 2007 and later), registration-free RTD servers (Excel 2002 and later) and customized Ribbon interfaces (Excel 2007 and 2010). There is support for integrated Custom Task Panes (Excel 2007 and later), offloading UDF computations to a Windows HPC cluster (Excel 2010 and later), and for the 64-bit versions of Excel 2010 and 2013.

Most managed UDF assemblies developed for Excel Services can be exposed to the Excel client with no modification. (Please contact me if you are interested in this feature.)

Since Excel-DNA uses the Excel C API, porting C/C++ add-in code based on the Excel XLL SDK is very easy. (No more XLOPERs!)

The Excel-DNA Runtime is free for all use, and distributed under a permissive open-source license that also allows commercial use.

Originally, the project was hosted on https://exceldna.codeplex.com, where you can still download the site in it's historic state as a package. After CodePlex' shutdown the archive site is however mostly unusable by now.

Latest Releases

The current version on NuGet is Excel-DNA Latest, released in October 2022.

Topics to Discuss Further