I'm trying to read the CSV file content into a java object. I found online resources that explains the two ways to read CSV ie., BufferReader/OpenCSV. But most of them are about reading row wise(I mean all the row data as one), the problem with my implementation is my CSV has the data in column wise like below:
UPDATE:
Name,A,B,C,D
JoinDate,1/1/2019,1/1/2018,06/01/2018,1/1/2019
Math_Marks,80,50,65,55
Social_Marks,80,50,86,95
Science_Marks,70,50,59,85
FirstLang_Marks,60,50,98,45
SecondLang_Marks,90,97,50
As you see the marks value are not mandatory, in above file person D has no marks listed for "SecondLang_Marks"
and my class object is below:
public class StudentVO {
private String name;
private Calendar joinDate;
private int math_Marks;
private int social_Marks;
private int science_Marks;
private int FirstLang_Marks;
private int secondLang_Marks;
// All get and set methods for class variables
}
can anyone please help me to read the above csv vertically based on vertical headers and load the values into class object.
If possible can you please give both examples using BufferReader and OpenCSV.
Thanks