Created
November 29, 2013 17:52
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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