add uuid to csv code example
Example: add uuid to csv
BufferedReader csvReader = new BufferedReader(new FileReader("Path to existing csv"));
String delimiter = ","
List> rows = new ArrayList<>();
String row;
while ((row = csvReader.readLine()) != null) {
String[] data = row.split(delimiter);
rows.add(Arrays.asList(data));
}
csvReader.close();
FileWriter csvWriter = new FileWriter("Path to final csv");
for (List rowData : rows) {
csvWriter.append(UUID.randomUUID().toString());
csvWriter.append(delimiter);
csvWriter.append(String.join(delimiter, rowData));
csvWriter.append(System.lineSeparator());
}
csvWriter.flush();
csvWriter.close();