0

I am using opencsv 2.3 for writing into CSV file.

CSVWriter writer = new CSVWriter(new FileWriter("data/output.csv"), '\t');

String[][] result = a.execute();

for (String[] line : result)
{
    writer.writeNext(line);   // example of line: a_1, 28
}

writer.close();

This code writes each line into a single cell, e.g. a_1"28".

How can I write a_1 into the 1st column and 28 into the second column?

Update 1: I think that this code works for opencsv 3.1, hower it seems to be not working for earlier versions.

Klausos Klausos
  • 15,308
  • 51
  • 135
  • 217

1 Answers1

1

You are using tab as separator. But your line is using comma as separator.

AbhinavRanjan
  • 1,638
  • 17
  • 21