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.