• Post Reply Bookmark Topic Watch Topic
  • New Topic

Download in Excel format  RSS feed

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I need to fetch data ( lots of rows and a few columns) from database and then
download the data or save it in the form of an excel sheet. The download should be such that it shows us the dialog box with options of either saving or opening the file.

Please suggest how to do it.
 
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, welcome to the ranch!

A two part answer - First, writing data out in Excel format is hard enough I'd choose "buy" over "build." Google for the POI package that reads and writes office formats. (Buy was in quotes, cause it's really free. )

The second part is telling the browser it's getting Excel data. You probably need to set a content-type header in the HTML response. Looks like I send "application/x-msexcel" in a little server I made. Then the browser should give the user the save/open choice.

Let us know if that helps!
 
Sekhar Kapoor
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot, The POI API really helped to make the excel possible.Also your suggestion to take one part at a time was great.Thanks again.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!