I use opencsv
(2.3 version) CSVWriter
to create csv file in java.
However while opening csv file I created, it is opened in such a way all the data are stored in single column.
CSVWriter I use to create CSV files:
File file = new File(fileName);
CSVWriter writer = new CSVWriter(new FileWriter(fileName, true), ';');
String[] col= new String[3];
for(Customer c : CustomerList) {
col[0] = c.getCustomerName();
col[1] = c.getCustomerId();
col[2] = c.getCustomerBirthDate();
writer.writeNext(col);
}
writer.close();
CSV File - all data in Single column:
"Micky";"1";"19901220"
"Grace";"2";"19901231"
Expected data aligned in cells peroperly:
Questions:
- Is it possible to make the data to place in its separate column using
CSVWriter
while writing only? - If it is not supported by opencsv should I use other csv?