Skip to main content



Excel-DNA

Free and easy .NET for Excel




Excel-DNA is an independent project that integrates .NET into Microsoft Excel to extend its native capabilities. Using C#, Visual Basic.NET or F#, it is possible to create a standalone add-in file (.xll) with high-performance user-defined functions (UDFs), custom ribbon interfaces, and much more!

Use .NET

Excel-DNA is a library that enables creation of Excel add-ins with .NET. Add-ins can be written in VB.NET, C# or F# (or a combination of these), using the Visual Studio IDE or a just a text editor.

Make User-Defined Functions

With Excel-DNA it is possible to create new worksheet functions that integrate with Excel's calculation model.

Create Custom Ribbon Add-ins

Excel-DNA add-ins can also extend the Excel user interface with ribbon enhancements and custom task panes.


Getting Started

The easiest way to make an Excel-DNA addin is to create to follow these simple steps:

Create a Project in Visual Studio

  1. Select Create a new project and then select Class Library in either Visual Basic, C# or F#.
  2. Enter a name for the project.
  3. Under Framework, select the .NET 6.0 (Long-term support) option.

Write the Addin Code

  1. Depending on the language of choice, in the .csproj, .vbproj, or .fsproj file, change the value between the TargetFramework tags to net6.0-windows.
  2. Add the following under </PropertyGroup>:
    <ItemGroup>
        <PackageReference Include="ExcelDna.Addin" Version="*-*"/>
    </ItemGroup>
  3. Depending on the language of choice (C#, Visual Basic.NET or F#), add the following code to the class file (.cs, .vb or .fs):
    using ExcelDna.Integration;

    public static class MyFunctions
    {
        [ExcelFunction(Description = "My first .NET function")]
        public static string SayHello(string name)
        {
            return "Hello " + name;
        }
    }

Compile and Run

  1. To compile the solution, ensure to explicitly select Build Solution, under the Build menu item at the top menu bar. Alternatively, press the Ctrl+Shift+B key combination.
  2. To run the code after compilation, select Start Debugging, under the Debug menu item at the top menu bar. Alternatively, press F5.
  3. When the solution is running, Excel will open and a security notice will pop-up. Select the Enable this add-in for this session only. option.
  4. In Excel, open a new workbook and use the newly created function:
    =SayHello("World!")

Debug

It is possible to debug the solution through Visual Studio. To do so, follow these simple steps while the solution is running:

  1. In Visual Studio, navigate to the line of code that is required debugging.
  2. Create a breakpoint by selecting Toggle Breakpoint, under the Debug menu item at the top menu bar. Alternatively, press F9. The line of code would be highlighted in red.
  3. In Excel, use the function that is needed to be debugged. The execution of the function will be caught by Visual Studio at the breakpoint. The line of code would be highlighted in yellow.
  4. In Visual Studio, inspect the code and change it as required. Once done, select Continue, under the Debug menu item at the top bar. Alternatively, press F5.
  5. Finally, see the new results reflect in Excel upon completion of execution of the debugged function.

Distribution

In order to use the newly created add-in, users would require the .NET 6 runtime to be installed. Additionally, the correct architecture (32bit or 64bit) of the installation should be taken into consideration.


Getting Help

For further help with Excel-DNA or to report an issue with the library, please feel free to contact us via our Excel-DNA Google Group, which is our primary support channel. Within the Google Group, it is possible to find detailed, responsive help to queries and a searchable archive with over 5000 messages.

Excel-DNA was made freely available because of our enthusiasm for Excel and the .NET Framework. We are looking forward to help you get started, knowing that the initial steps could be daunting to some. All Excel-DNA questions are welcome!


Supporting Excel-DNA

Encouragement of future development of Excel-DNA, and access to direct support can be achieved through:

  • Sponsoring the project via GitHub Sponsors, or
  • entering into a Corporate Support Agreement.

Sponsorship

Sponsoring the Excel-DNA project is greatly appreciated and a monthly or once-off payment can be made through GitHub at: https://github.com/sponsors/Excel-DNA

Corporate Support Agreements

Corporate users who are using the Excel-DNA library as part of their critical infrastructure, may want to enter a more formal and direct Corporate Support Agreement. For an annual subscription fee this will ensure:

  • Continuity of the Excel-DNA project, with ongoing development and maintenance, adapting to new versions of Excel and .NET.
  • Access to direct assistance and support in using the library.
  • Priority for bug-fixes and feature requests.

For more details, please contact us by email: govert@dnakode.com


Testimonials

"Excel-DNA is one of the most impressive open-source projects in the space. Its flexibility and simplicity have allowed us to create a powerful Excel Addin with a small team." - Kevin Fox, CTO, YCharts

 


Jane Street uses Excel-DNA.

 


"We migrated to Excel-DNA, which has simplified greatly our Excel interfacing. It is a superb product, superior to others we have used previously, and Govert is incredibly responsive and helpful in maintaining and improving it." - Alberto Cherubini, EQ Finance

 

"Excel-DNA is in use in our major locations around the world and in many mission critical scenarios. Usage covers the full gamut of features from simple UDF add-ins to managing real-time trading flow, interacting with order management systems. The open source Excel-DNA project is incredibly useful to us. Thanks very much to Govert and contributors." - Paul Gresham, Hong Kong.

 

"I have never programmed with Excel and Excel-DNA allowed me build Calcbench's Excel Add-In in two weeks." - Andrew Kittredge, Calcbench

 

"Excel-DNA is incredibly versatile and stable framework for building Excel add-ins and user-defined functions. With such a pivotal element in our project, we were very concerned about committing to Excel-DNA that was developed by an enthusiast. However, we quickly learned that Govert has created an outstanding open source project; that he is keen on helping with any challenging questions and that the community is active enough to sustain a healthy evolution of Excel-DNA." - Ilya Vadeiko, FinDynamics

 

"Excel-DNA is the open source project that quietly delivers a robust and simple to use extensibility framework for Microsoft Excel. When we felt we had outgrown VBA, no longer wanted the complexity of C++ and were thoroughly fed up with VSTO, Excel-DNA seemed a great choice and we haven't been let down.

In Excel-DNA, combined with his incredible understanding of Excel integration, the .Net framework and passion for wanting to help others, Govert continues to deliver a project that makes Excel-DNA a 'no brainer' choice.

Thank you to Govert and to everyone involved in Excel-DNA - well done." - Simon Miles, Solution 7