Unwanted double quotes in generated csv file

Edward picture Edward · Dec 20, 2012 · Viewed 43k times · Source

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.

Answer

Shamis Shukoor picture Shamis Shukoor · Dec 20, 2012

This worked for me

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

See the CSVWriter javadoc