I have a csv file that look like this:
name,age,total
xyz,22
abc,20
After processing the csv file should look like this:
name,age,total
xyz,22,100
abc,20,102
After running this code:
public class Converter {
public static void main(String[] args) throws IOException {
BufferedWriter writer = Files.newBufferedWriter(Paths.get(Constants.SAMPLE_CSV_FILE));
CSVPrinter csvPrinter = new CSVPrinter(writer, CSVFormat.DEFAULT);
csvPrinter.print(100);
csvPrinter.print(102);
csvPrinter.close();
}
}
the output csv file becomes like this:
100
102
I want 100 and 102 to come under the total column. How can I do this?