Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resultset to Excel file

There is CSVWriter class for writing resultset to CSV file.

Is there any similar class for writing resultset output to EXCEL file.??

Edit: My resultset data will be dynamic so I just want to dump the resultset data into excel file

Edit2: Ref http://www.codereye.com/2009/09/converting-resultset-to-excel-table-in.html. It exports the data to excel sheet but I need to pas the datatype of each column .I want to remove that dependency so that whatver is in the resultset ,blindly it should export to excelsheet.

like image 717
happy Avatar asked Feb 20 '23 01:02

happy


1 Answers

I recently used OpenCSV, it worked fine for me. Here, for example, how to write a ResultSet to a CSV file:

java.sql.ResultSet myResultSet = ...

writer.writeAll(myResultSet, includeHeaders);
like image 184
Maxx Avatar answered Feb 27 '23 09:02

Maxx