Export dataset to the excel sheet in asp.net c#

First of all your function start streaming content

 Response.ContentType = "application/vnd.ms-excel";
                Response.AppendHeader("Content-Disposition", "attachment; filename=" + filename + "");

to end user and END it with

Response.End();

Moreover if you fix this your code will product 4 excel files.

There is an existing code for creating Excel sheets on stack overflow: How to add additional worksheets to an Excel from DataTable The only change you will have to made will be saving xlsx to stream and transmit this stream to user.