I am reading a csv file using apache camel csv data format and I am unmarshalling the content of the file.
when reading the data I have to remove spaces between column name header.
For example if the column name is "First Name", the space between them should be removed and it should be processed a "FirstName".
CsvDataFormat csvdataformat = new CsvDataFormat();
csvdataformat.setSkipHeaderRecord(true);
csvdataformat.setUseMaps(true);
from("file:/folder1/?fileName=sample.csv")
.routeId("samplerouteid")
.autoStartup(false)
.unmarshal(csvdataformat)
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
/*code to process data*/
}
});
How to achieve this using Apache Camel CSV ?