I have a CSV file(excel) in which each data is available in cell like excel. I'm using Apache CSV to parse excel type csv. While parsing the data my each character is getting separated by null character in between. This CSV file I'm getting from different source but when I'm copying the same excel csv file data and making a excel csv file manually, my below code able to get the desired output.
My Code:
InputStream is =null;
Reader in =null;
is = new ByteArrayInputStream(excelCSVFile);
in = new InputStreamReader(is);
CSVParser parser = new CSVParser(in, CSVFormat.EXCEL.withHeader("EMPLOYEE_ID","NAME","DOJ",
"MOBILE_NO").withSkipHeaderRecord(true).withTrim(true));
List<CSVRecord> records = parser.getRecords();
for (CSVRecord record : records) {
System.out.println("Employee Id::"+record.get("EMPLOYEE_ID"));
System.out.println("Employee Name::"+record.get("NAME"));
}
I'm getting output here by above code is:
When I checked the ASCII value for blank character I got '0' as value means Null character.