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
  • 34,866
  • 14
  • 107
  • 142
glenn
  • 143
  • 2
  • 4
  • 14

3 Answers3

2

Here is a utility that does CSV reading and writing:

http://opencsv.sourceforge.net/

astay13
  • 6,857
  • 10
  • 41
  • 56
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
  • 354,903
  • 100
  • 647
  • 710
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
  • 913
  • 1
  • 10
  • 22