How to export ASP.NET MVC view data to an excel file ?
Actually my view page contain many viewdata types.
I am using for each loop with these datatype to displaying data on
You could loop through the Keys/Values of your ViewData and generate the excel file (various options mentioned Here) or simply to CSV
But I would recommend rather doing this in the controller and returning a FileResult and not from the ViewData (which I presume you using in your View).