If you are generating the excel in a browser just call the method you want to generate the excel file based on a url and set the response properties like this,

//1.Fill the data from db

...