updating specific cell csv file using java

前端 未结 5 957
悲哀的现实
悲哀的现实 2020-12-06 15:07

Hi i have a small problem and think i\'m just not getting the correct syntax on one line of code. basically, i can write into my csv file and find a specific record using st

5条回答
  •  抹茶落季
    2020-12-06 16:01

    I used the below code where I will replace a string with another and it worked exactly the way I needed:

    public static void updateCSV(String fileToUpdate) throws IOException {
            File inputFile = new File(fileToUpdate);
    
            // Read existing file
            CSVReader reader = new CSVReader(new FileReader(inputFile), ',');
            List csvBody = reader.readAll();
            // get CSV row column and replace with by using row and column
            for(int i=0; i

提交回复
热议问题