in reply to @ downloading generated excel file

Check out the CGI module it has what you need, the -attachment header option is what you need.