0

Can someone point me to some good tutorials for generating a resultset into a CSV or even Excel file?

I'm using j2ee, with Spring and Hibernate.

Nakilon
  • 33,683
  • 14
  • 104
  • 137
glenn
  • 159
  • 2
  • 4
  • 14

3 Answers3

2

Here is a utility that does CSV reading and writing:

http://opencsv.sourceforge.net/

astay13
  • 6,557
  • 9
  • 37
  • 55
1

can someone point me to some good tutorials for generating a resultset into a csv

It's extremely straightforward to roll your own — just make sure to use StringBuilder or Joiner. Or, use a library.

or even excel file.

You'll want to use Apache POI for that.

Community
  • 1
  • 1
Matt Ball
  • 344,413
  • 96
  • 627
  • 693
0

Use opencsv 2.2.jar

http://opencsv.sourceforge.net/

CSVWriter writer = new CSVWriter(new FileWriter("yourfile.csv"), '\t'); // feed in your array (or convert your data to an array) String[] entries = "first#second#third".split("#"); writer.writeNext(entries); writer.close();

Niroshan Abayakoon
  • 903
  • 1
  • 10
  • 22