How to write data into CSVFile using CSVWriter | write data into csv file using java

Опубликовано: 11 Март 2023
на канале: Azhar Techno Coder
757
31

How to write data into CSVFile using CSVWriter | write data into csv file using java

Code:
package com.general.interviewQuestions;
import java.io.FileWriter;
import com.opencsv.*;
public class writeCSVFileCSVWriter {

public static void main(String[] args) {
CSVWriter writer = null;
try {
writer = new CSVWriter(new FileWriter("C:/Users/AZHAR PC/eclipse-workspace/GeneralInterviewQuestions/DataFiles/csvWriter.csv"));
String[] header = {"Sno","Name"};
writer.writeNext(header);
String[] rowValues = {"1","Azhar"};
writer.writeNext(rowValues);
writer.close();


}catch(Exception e) {
e.printStackTrace();
}
}

}

Chapters:
0:00 - Introduction to the video


Next Steps :

---------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------
Must Watch Playlists

► 1. Javascript -    • Javascript Factory  
► 2. Puppetter -    • Puppeteer  
► 3. Cypress -    • Cypress  
► 4. Tech works -    • Video  
► 5. Vbscript Basics To Advanced -    • VBScript Part 1 -  Features Advantage...  
► 6. Jmeter -    • Jmeter Tutorials  
► 7. Excel -    • Videos On Excel  
► 8. Appium -    • Appium  
► 9. Shares -    • Shares  
► 10. Javascript Interview Questions -   • Javascript Interview Questions  
► 11. C# Tutorials -    • C# Factory  
► 12. HTML & CSS -    • HTML & CSS  
► 13. Browser Console -    • Browser Console  
► 14. JSON -    • Videos on Json  
► 15. Specflow -    • Specflow Tutorials  
► 16. MongoDB -    • MongoDB Tutorials  
► 17. Postman -    • Postman  
► 18. Python -    • Python  
► 19. Typescript -    • Typescript & Node Imp Questions  
► 20. Node -    • Node  
► 21. Java Selenium Interview Questions:    • Java and Selenium Imp  
► 22. Real Time Interview Q & A:    • Real Time Interview Questions  
---------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------

#writecsv
#java
#csvwriter