[Solved] Is there any function to write 2D Array which fetch the data into csv file?

[ad_1]

You can use CSVWriter for this with writeAll() method. It doesn’t work on two dimensional array, but it works with Iterable<String[]> or List<String[]>, so you will need to do conversion first.

String[][] table = ...;
List<String[]> convertedTable = Arrays.asList(table);
CSVWriter writer = new CSVWriter(new FileWriter(csvFilename));
writer.writeAll(convertedTable);
writer.close();

2

[ad_2]

solved Is there any function to write 2D Array which fetch the data into csv file?