It’s been a couple of years and it’s time for a small update to GroovyCSV. There’s a been a bug fix or two but the main news is the option to get a map representation of your csv’s line-data. A feature contributed by gmazelier. Thank you!
It’s now possible to get a map representation of your line data using line.toMap()
.
Example:
@Grab('com.xlson.groovycsv:groovycsv:1.1')
import static com.xlson.groovycsv.CsvParser.parseCsv
def csv = '''ProjectName,Version,Year
GroovyCSV,1.1,2015'''
def data = parseCsv(csv)
for(line in data) {
println line.toMap()
}
Output:
[ProjectName:GroovyCSV, Version:1.1, Year:2015]
GroovyCSV is available from Maven Central:
Group: com.xlson.groovycsv
Artifact: groovycsv
Version: 1.1
Or you can download it from Github: