Skip to content

Instantly share code, notes, and snippets.

@nicdoye
Created November 29, 2013 17:52
Show Gist options
  • Save nicdoye/7709502 to your computer and use it in GitHub Desktop.
Save nicdoye/7709502 to your computer and use it in GitHub Desktop.
Quick example of using Apache Commons CSV (1.0-Snapshot) to write to a CSV file in groovy.
import org.apache.commons.csv.CSVPrinter
import org.apache.commons.csv.CSVFormat
CSVPrinter printer = new CSVPrinter(
new PrintWriter("test.csv"),
CSVFormat.DEFAULT
)
answer = [ [5,6,"asdf",7],[9,10,"a b","z,x",12]]
answer.each {
printer.printRecord(it)
}
printer.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment