I have 3 csv files. Each file contains 10 columns but only 1 of them has different values.
As shown in the pictures, only the destination name is different per language.
What I want to become is csv file looking like this:
How do I put the columns between the existing columns and how do I change their headers as wel (DEST_NAME_DISPLAY --> DEST_NAME_EN)?
So far I've little experience with csv manipulation besides reading a csv file with Super csv
Example of what i know so far
public List<City> readWithCsvMapReader(String file, String source) throws IOException, AuthenticationException, RepositoryException {
ICsvMapReader mapReader = null;
FileInputStream stream = new FileInputStream(file);
InputStreamReader reader = new InputStreamReader(stream, ENCODING);
try {
mapReader = new CsvMapReader(reader, PREFERENCE);
final String[] header = mapReader.getHeader(true);
final CellProcessor[] processors = getProcessors();
Map<String, Object> locationMap;
while ((locationMap = mapReader.read(header, processors)) != null) {
/*do some logic*/
}
} finally {
if (mapReader != null) {
mapReader.close();
}
}
}
public CellProcessor[] getProcessors() {
final CellProcessor[] processors = new CellProcessor[]{
new NotNull(), // COU_ID
new NotNull(), // COU_NAME
new NotNull(), // DEST_ID
new NotNull(), // DEST_NAME_DISPLAY
new Optional(), //DEST_PARENT_ID
new NotNull(), // DEST_STATION_COUNT
new NotNull(), // DEST_CHILD_DEST_COUNT
new NotNull(), // DEST_FLAG_APT
new NotNull(), // DEST_FLAG_WIN
new NotNull(), // DEST_FLAG_DEL
};
return processors;
}