This article shows how to export a Data Table to Excel in ASP.NET MVC.
The following is my Data Table in design mode.

Image 1. Design Mode
Script Of Employee Table
Data in Employee Table

Image 2. Employee Table
Now open Visual Studio 2012, then select New -> Project.
![New Project]()
Image 3. New Project
![MVC]()
Image 4. New ASP.Net MVC
Now add a ClosedXML reference.
![Data Table]()
Image 5. Export Data Table
Now right-click on the Model folder, then select Add New Class. ExportDataTableToExcelModel.cs.
Now right-click on the Controller Folder, then select Add -> Controller.
![Controller]()
Image 6. Controller
![Add Controller]()
Image 7. Add Controller
Now here in ExportDataController, add the following code.
Now right-click on the Index Folder, then select Add View.
![Add View]()
Image 8. Add View
View. cshtml
The following is my connection string in Web.config.
Now, run your application.
![Excel]()
Image 9. Excel In MVC4
![Export Data]()
Image 10. Export DataTable to Excel
![Employee Report]()
Image 11. Employee Report