Leonard Gram home

GroovyCSV 0.2 Released

The first final release of Groovys very own CSV parsing library is out. Also, it’s up on Maven Central which should make it a lot easier to get. There have been some minor changes to the API since I posted about csv-parser the first time but the biggest change is probably the new name and package structure.

Changes since 0.1

Example using @Grab and custom separator

Because GroovyCSV is now up on Maven Central it’s really easy to use in your Groovy scripts. This example shows how you can make GroovyCSV available using @Grab as well as how you can use custom separators and quote character.

@Grab('com.xlson.groovycsv:groovycsv:0.2')
import com.xlson.groovycsv.CsvParser

def csv = '''Name-Lastname
Mark-'Anderson-Nielsen'
Pete-Hansen'''

def data = new CsvParser().parse(csv, separator: '-', quoteChar: "'")
for(line in data) {
    println "$line.Name $line.Lastname"
}

Output

Mark Anderson-Nielsen
Pete Hansen

Getting GroovyCSV

GroovyCSV is available from Maven Central with the following information:

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

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