Here Mudassar Ahmed Khan has explained with an example, how to return an Excel File from Controller in ASP.Net MVC Razor using C#.
The Excel File will be generated from database using Entity Framework and then it will be returned from Action method of Controller with FileResult return type in ASP.Net MVC Razor.