Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

how to read from a CSV file using Groovy script .

Abyakta Lenka September 4, 2018

Hello ,


I am trying to read a CSV file which has two columns 

issue_key | custom_filed_value 

i am trying to get the value of key and value using groovy script so that i can update the issue key got from the CSV .

Any help is highly appreciated .


4 answers

Suggest an answer

Log in or Sign up to answer
2 votes
Areg Vrtanesyan (Work) March 13, 2019

I have used Super CSV to read data but in confluence.

Should work in Jira too

Also it is good idea to run dos2unix if you have it in Linux to fix format and encoding.


// Misc manipulations
import java.nio.charset.StandardCharsets

// CSV Imports -
import org.supercsv.prefs.CsvPreference
import org.supercsv.cellprocessor.CellProcessorAdaptor
import org.supercsv.cellprocessor.ift.CellProcessor
import org.supercsv.cellprocessor.Optional

def csvFile="/some/path/csvFile.csv"
// as in
CsvPreference PIPE_DELIMITED = new CsvPreference.Builder('"', '|', "\n").build()

def mapReader = new CsvMapReader(new InputStreamReader(new FileInputStream(localFilePath), StandardCharsets.UTF_8), PIPE_DELIMITED)

def header = mapReader.getHeader(true)

while ( (issuesMap = != null ) {

def issueKey = issuesMap."issue_key" def cfValue = issuesMap."custom_filed_value"
// Rest is to find issue by Key in Jira and use mutable Issue and CF Manager to set CF value


1 vote
Dirk Penné
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 18, 2019

Same problem here...anyone to help us?

0 votes
Joel March 13, 2019

Also am interested in this.

AUG Leaders

Atlassian Community Events