Introduction

Excel-DNA is an independent project to integrate .NET into Excel. I 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 2010 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.)

The latest release - Excel-DNA version 0.32 - 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.

Important Links

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, http://groups.google.com/group/exceldna, where an extensive history of discussions can found and searched through.

You are also welcome to contact me (Govert) directly at govert@icon.co.za with questions, comments or suggestions.

Getting Started

If you are using a version of Visual Studio that supports the NuGet Package Manager (including Visual Studio 2012 Express for Windows Desktop), the easiest way to make an Excel-DNA add-in is to:
  1. Create a new Class Library project in Visual Basic, C# or F#.
  2. Use the Manage NuGet Packages dialog or the Package Manager Console to install the Excel-DNA package: PM> Install-Package Excel-DNA

The Excel-DNA NuGet Package installs the required files and configures your project to build an Excel-DNA add-in.

Alternatively, get the full Excel-DNA Download from CodePlex, and work through the Getting Started page. The download includes a step-by-step guide to making your first C# add-in, and more information is available on the Documentation page.

External Links

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.

Next, check out the brilliant step-by-step tutorial series by Ross McLean:
As a comprehensive example using many of the Excel-DNA features, be inspired by the Financial Analytics Suite (FinAnSu), an open-source C# add-in built by Bryan McKelvey.

Or browse through the variety of samples and tutorials elsewhere:
Here are some useful F# examples -
Projects using Excel-DNA

And if you get stuck or have any questions, don't hesitate to ask on http://groups.google.com/group/exceldna.

Related Projects

  • 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 is an established, commercial product to easily create .xll libraries in .NET. If ManagedXll were free, Excel-DNA would not exist.
  • Statfactory's FCell is a commercial add-in library with similar goals as Excel-DNA, based on F#.
  • 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:
    • I initially used the XLW open-source library.
    • The XLL+ toolkit is a highly regarded commercial option.
    • Keith Lewis has some modern C++ libraries for making .xlls, available on CodePlex at http://xll.codeplex.com/.

Performance

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

Formal Support Agreements

Corporate users of Excel-DNA, using the library as part of their mission critical infrastructure, are encouraged to enter into a formal support arrangement. I offer an annual subscription-based technical support agreement, providing direct support, priority bug-fixes and feature development and ensuring that Excel-DNA will continue to be updated and developed. For more details, please contact me by email at govert@icon.co.za.

Donations

Financial support for the Excel-DNA project encourages future development and is greatly appreciated. Transactions are processed by PayPal.
Donate via PayPal

Last edited Sep 2 at 9:43 PM by govert, version 107