Skip to content
Advertisement

Unwanted double quotes in generated CSV file

I have created a CSV file using the Java code below:

String csv = rs.getString("UPLOAD_FOLDER_PATH")+".csv";
CSVWriter writer = new CSVWriter(new FileWriter(csv));
String [] filevalues = new String[filevaluesarray.size()];

filevalues=filevaluesarray.toArray(filevalues);

writer.writeNext(filevalues);

writer.close();

I am getting the CSV file, but the content of the file has unwanted double quotes.

Eg. “ABC”,”123″,”KDNJ”

I don’t get from where these double quotes are added.

Advertisement

Answer

This worked for me

CSVWriter writer = 
    new CSVWriter(new FileWriter(csv), ',', CSVWriter.NO_QUOTE_CHARACTER);

See the CSVWriter javadoc

Advertisement