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!
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.
The easiest way to make an Excel-DNA addin is to create to follow these simple steps:
Create a Project in Visual Studio
- Select Create a new project and then select Class Library in either Visual Basic, C# or F#.
- Enter a name for the project.
- Under Framework, select the .NET 6.0 (Long-term support) option.
Write the Addin Code
- Depending on the language of choice, in the .csproj, .vbproj, or .fsproj file, change the value between the TargetFramework tags to net6.0-windows.
- Add the following under </PropertyGroup>:
<PackageReference Include="ExcelDna.Addin" Version="*-*"/>
- Depending on the language of choice (C#, Visual Basic.NET or F#), add the following code to the class file (.cs, .vb or .fs):
public static class MyFunctions
[ExcelFunction(Description = "My first .NET function")]
public static string SayHello(string name)
return "Hello " + name;
Public Module MyFunctions
<ExcelFunction(Description:="My first .NET function")>
Public Function SayHello(ByVal name As String) As String
Return "Hello " & name
module MyFunctions =
[<ExcelFunction(Description = "My first .NET function")>]
let SayHello name = "Hello " + name
Compile and Run
- 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.
- To run the code after compilation, select Start Debugging, under the Debug menu item at the top menu bar. Alternatively, press F5.
- 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.
- In Excel, open a new workbook and use the newly created function:
It is possible to debug the solution through Visual Studio. To do so, follow these simple steps while the solution is running:
- In Visual Studio, navigate to the line of code that is required debugging.
- 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.
- 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.
- 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.
- Finally, see the new results reflect in Excel upon completion of execution of the debugged function.
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.
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!
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.
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: email@example.com
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