I need the data from the array to be output to the csv file in a line (so that later in the excele they were in different cells) Here is the code: I created the csv file itself:

String csv = "data.csv"; CSVWriter writer = new CSVWriter(new FileWriter(csv, true)); //Create record String [] record = name.trim().split(","); String str_track = sc.nextLine(); writer.writeNext(record); 

Next, I divide the string into elements, creating an array of them:

 String [] str_tr; String delimeter = "\t"; // Разделитель str_tr = str_track.split(delimeter); 

And I do not know how to correctly display them in the table, please tell me!

    1 answer 1

    Here is how to display them in the table:

     Row currentRow = sheet.createRow(rowNum++); for(int i=0; i < nextLine.length; i++) { if(NumberUtils.isDigits(nextLine[i])) { currentRow.createCell(i).setCellValue(Integer.parseInt(nextLine[i])); } else if (NumberUtils.isNumber(nextLine[i])) { currentRow.createCell(i).setCellValue(Double.parseDouble(nextLine[i])); } else { currentRow.createCell(i).setCellValue(nextLine[i]) } } 

    The following attachments need to be inserted.

     <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.17</version> </dependency> 
    • Sorry, but which library is used? @Roman C - Vqq50
    • See update. - Roman C