Creating headers for CSV file
19,344
Here is your solution :
CSVWriter csvWrite = new CSVWriter(new FileWriter(csvFile));
String[] entries = {"eid","name","vid","emp_id","balance_amt","handover_to","entry_date"};
csvWrite.writeNext(entries);
thats working fine here ! try
Author by
iam user
Updated on June 28, 2022Comments
-
iam user almost 2 years
I'm writing a CSV file using the Opencsv library and need to add headers to my file. The file is created and the headers are inserted, but all the headers in same cell.
csvFile.createNewFile(); CSVWriter csvWrite = new CSVWriter(new FileWriter(csvFile)); String heading = "eid,name,vid,emp_id,balance_amt,handover_to,entry_date \n"; csvWrite.writeNext(new String[]{heading});
-
iam user over 7 yearsif there is any possible way to change the color for header? bcz some one says its possible to do that..
-
Abhinav Saxena over 5 yearsPlease complete your answer with the library/dependencies (gradle) you are using for this solution, and the configuration code if necessary.
-
Deepak Kumar over 5 yearsIn this question, you'll get the library and just answering the question that @iam user asked.