File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes how to export data to Excel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Java in General
Bookmark "how to export data to Excel" Watch "how to export data to Excel" New topic

how to export data to Excel

Ramakrishnan Ponmudi
Ranch Hand

Joined: Apr 20, 2004
Posts: 72
In core java, how to export data to MS-EXCEL
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
Learn the excel file format, construct a properly formed file in a byte[], and write it out to a file.

Or you might want to look at a third party library like poi.

There may be a way through ODBC, but I've never tried it and you still might need some additional library.
[ May 26, 2005: Message edited by: Steven Bell ]
Joe Ess

Joined: Oct 29, 2001
Posts: 9088

I've had success creating a comma-seperated text file and naming it something.csv. Excel is associated with the CSV extension so it will open the file if you click on it in Windows Explorer.

[How To Ask Questions On JavaRanch]
Mark Wuest
Ranch Hand

Joined: Jun 07, 2003
Posts: 88
Originally posted by Ramakrishnan:
In core java, how to export data to MS-EXCEL

I've had Excel-lent (sorry!) success with the already-mentioned jakarta poi hssf project. Go get poi. There's working sample code in the docs.

It is sorta covered in the JavaRanch Style Guide.
subject: how to export data to Excel