@Grapes( @Grab(group='com.opencsv', module='opencsv', version='4.1') ) import com.opencsv.* Writer writer = new StringWriter() CSVWriter csvWriter = new CSVWriter(writer, CSVWriter.DEFAULT_SEPARATOR, // tab일경우 (char) '\t' CSVWriter.DEFAULT_QUOTE_CHARACTER, CSVWriter.DEFAULT_ESCAPE_CHARACTER, CSVWriter.DEFAULT_LINE_END) csvWriter.writeNext(['Title1', 'Title2', 'Title3', 'Title4'] as String[]) csvWriter.writeNext(['value1', 'value2', 'value3', 'value4'] as Strign[]) ... csvWriter.close() println writer.toString()