Leonard Gram home

Releasing GroovyCSV 1.0

When GroovyCSV 0.2 was released back in November of 2010 I thought it might actually be the final release, at the time I couldn’t think of anything else to add. Still, calling a first release 1.0 is the same as asking for trouble.

Now, 1 year and 3 months later, with no mayor issues and only few bits of new code I’m confident enough to call the next release 1.0.

Additions since 0.2

A special thanks goes out to Antoine Roux for writing the autodetection feature!

Examples of the new features

Autodetection of separator

One of the new features in this release is the possibility to autodetect what separator and quote characters are used.

These chars are used for autodetection:

Separators = ,;:|
Quotes = "'%


import static com.xlson.groovycsv.CsvParser.parseCsv

def csv = '''Name:Lastname

def data = parseCsv(csv, autoDetect:true)
for(line in data) {
    println "$line.Name $line.Lastname"


Mark Andersson
Pete Hansen

Parsing a headerless file

Another feature in this release is better tooling to handle csv data without column names at the top, or with bad names. For example, if there’s no header line, you will probably wanna read the first line, do it by setting readFirstLine:true. After that you can either access the values using their index or by setting custom column names, both is demonstrated below.


import static com.xlson.groovycsv.CsvParser.parseCsv
def csv = '''Apple,2
def data = parseCsv(csv, readFirstLine:true,
                    columnNames:['fruit', 'qty'])
for(line in data) {
    println "$line.fruit ${line[1]}"


Apple 2
Pear 5

Getting GroovyCSV

GroovyCSV is available from Maven Central with the following information:

Group: com.xlson.groovycsv
Artifact: groovycsv
Version: 1.0

Or you can download it from Github:

More information

One last thing

I’d love to hear from you if you’re using GroovyCSV, especially suggestions on improvements and bug reports. Keep the feedback coming! :)

blog comments powered by Disqus
Fork me on GitHub