File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exporting ResultSet data to MS Excel

 
Easwar Murthi
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to write a List into an Excel file. The List is essentially retrieved from a MySQL DB. Is there a code that can be used to achieve this? Please help...

Thank you,
Easwar
 
Campbell Ritchie
Sheriff
Pie
Posts: 47232
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Sorry that nobody has replied earlier. Don't know about direct input to Excel, but it is quite easy to change the output to comma separated format; Excel opens csv files by default.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33694
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Easwar,
Welcome to JavaRanch!

If you just need a file that opens in Excel, I second the CSV format. If you need to have Excel formatting, you can use an Excel library. The open source POI HSSF is a good one.

You still have to loop through the result set and output the results in CSV/HSSF. You could do generically in one place for your app though.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic