Reads a file in the current working directory or a String as a plain text. A List of CSVRecord instances is returned

Example:

def records = readCSV file: 'dir/input.csv'
assert records[0][0] == 'key'
assert records[1][1] == 'b'

def records = readCSV text: 'key,value\na,b'
assert records[0][0] == 'key'
assert records[1][1] == 'b'
	

Advanced Example:

def excelFormat = CSVFormat.EXCEL
def records = readCSV file: 'dir/input.csv', format: excelFormat
assert records[0][0] == 'key'
assert records[1][1] == 'b'

def records = readCSV text: 'key,value\na,b', format: CSVFormat.DEFAULT.withHeader()
assert records[0].get('key') == 'a'
assert records[0].get('value') == 'b'