Click here to Skip to main content
15,892,517 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Consider a csv file,
Name,id,Science,Maths,English
ABC,2,80,90,100
DEF,1,23,32,33

Now i need to update mark of ABC in Maths column from 90 to 100 using the java code

Is there any method in Apache-csv to change the value of file based on the row value - ABC and column value - Maths

Eg - obj.updatedata[1][3] using Java code

Kindly let me know the code can be used here for this scenario

What I have tried:

I have tried updating using Array list method where i will be hardcoding my input parameters which needs to be replaced.
Posted
Updated 28-Oct-19 1:02am

1 solution

Use the CSVParser class to read the records and the CSVPrinter to write out the updated values. The documentation at org.apache.commons:commons-csv:1.7 api doc - javadoc.io[^] contains the class details and samples.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900