Convert Dataset to Excel in ASP.net

The below method accepts a Dataset as an argument and generates an excel file with the specified file name in the second argument to the method.
Nowadays in many web application, we need to display the contents of a dataset into an excel file, so that all records can be viewed by the user.
The below method will provide a solution to this requirement.
All the user needs to do is call the method specifying the dataset and the filename.
eg:-
ExportDataSetToExcel(dsEmployeeDetails,"EmpDetails.xls");
Note : This is not applicable for Microsoft Office 2007 and above

I was using the approach I mentioned before to get only the gridview to excel.
till now I was happy with it but now I found that the file getting downloaded is not an excel but an html with ext xls
it opens normally without any problems, but when I save the file, it created the html's associated folder "abc_files"

Also one more problem I encountered was that the data appearing in gridview does not appear same in excel.
excel interprets the datatype and displays accordingly.
like the value 10.0 in gridview displays as 10 only in excel.