Read CSV Data in Java with CSVReader ๐Ÿ“„

Learn how to read CSV files in Java using CSVReader with a simple example and necessary dependencies.

Read CSV Data in Java with CSVReader ๐Ÿ“„
Azhar Techno Coder
680 views โ€ข Mar 10, 2023
Read CSV Data in Java with CSVReader ๐Ÿ“„

About this video

How to Read Data from CSV file in Java | Reading a CSV with CSVReader Example in Java

PreRequisite:
Add a dependency of opencsv in pom.xml

dependency
groupId com.opencsv /groupId
artifactId opencsv /artifactId
version 5.7.0 /version
/dependency

Chapters:
0:00 - Introduction to the video
0:36 - Reading a CSV with CSVReader Example in Java
3:55 - Execution of the program

Code:
package com.general.interviewQuestions;
import java.io.FileReader;
import com.opencsv.CSVReader;

public class readCSVFileCSVReader {
public static void main(String[] args) {
CSVReader reader = null;
try {
reader = new CSVReader(new FileReader("C:/Users/AZHAR PC/eclipse-workspace/GeneralInterviewQuestions/DataFiles/ScannerCsv.csv"));
String[] next;
while((next = reader.readNext())!= null) {
for(String csvFileValues:next) {
System.out.print(csvFileValues+" ");
}
System.out.println("\n");
}
}catch(Exception e) {
e.printStackTrace();
}

}
}


Next Steps :

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

โ–บ 1. Javascript - https://youtube.com/playlist?list=PLO2l2fYgN805CokP5kaOWOhqP3-2vyXdS
โ–บ 2. Puppetter - https://youtube.com/playlist?list=PLO2l2fYgN805E5fbSnvtFM3K9c92ePS8e
โ–บ 3. Cypress - https://youtube.com/playlist?list=PLO2l2fYgN807KRpLfvvrqa1MSX8XdYxkV
โ–บ 4. Tech works - https://www.youtube.com/watch?v=ZNAdt4Oe5Sw&list=PLO2l2fYgN807CQ5H3ER__7x7LeEA10T2Z
โ–บ 5. Vbscript Basics To Advanced - https://www.youtube.com/watch?v=z_ctZDolyG0&list=PLO2l2fYgN805CuD-90ESrxRqX__-YJMym
โ–บ 6. Jmeter - https://youtube.com/playlist?list=PLO2l2fYgN806eNr5cr-TMTX8xGTW7Mtcn
โ–บ 7. Excel - https://youtube.com/playlist?list=PLO2l2fYgN806piZ2fD0bYNi3ExoPJlcqj
โ–บ 8. Appium - https://www.youtube.com/playlist?list=PLO2l2fYgN806V_9-wL-dpmrGg8dhPPONK
โ–บ 9. Shares - https://youtube.com/playlist?list=PLO2l2fYgN806ySmKp3sskJW0ByJalmPE2
โ–บ 10. Javascript Interview Questions -https://youtube.com/playlist?list=PLO2l2fYgN807uZl7Mp7ESavluzVU25ux9
โ–บ 11. C# Tutorials - https://www.youtube.com/playlist?list=PLO2l2fYgN805Dct9KbYNYC8nGOzwKjklt
โ–บ 12. HTML & CSS - https://www.youtube.com/playlist?list=PLO2l2fYgN804tkFuKw9DlcVXT0m8hDzdw
โ–บ 13. Browser Console - https://www.youtube.com/playlist?list=PLO2l2fYgN80692hfTP1BcgmWNBZV0ZYzo
โ–บ 14. JSON - https://www.youtube.com/playlist?list=PLO2l2fYgN8062RQNrQt5xAQZFaFINvMsY
โ–บ 15. Specflow - https://www.youtube.com/playlist?list=PLO2l2fYgN806s2KXmhI6eqHLwP_sriPl0
โ–บ 16. MongoDB - https://www.youtube.com/playlist?list=PLO2l2fYgN80626nl1UkUz3ufXSlgMXIkh
โ–บ 17. Postman - https://youtube.com/playlist?list=PLO2l2fYgN804Nf9Vfma54yFNwlA3bF9-Z
โ–บ 18. Python - https://youtube.com/playlist?list=PLO2l2fYgN80486BcimGYi9Y3XQ-beQHCN
โ–บ 19. Typescript - https://www.youtube.com/playlist?list=PLO2l2fYgN805MyyI2Q1YpkX78OehOqzDg
โ–บ 20. Node - https://www.youtube.com/playlist?list=PLO2l2fYgN807v_icJITbdYV_IP5wdgDIy
โ–บ 21. Java Selenium Interview Questions: https://www.youtube.com/playlist?list=PLO2l2fYgN806mr2M9Km0KNQz_wv_tZTwD
โ–บ 22. Real Time Interview Q & A: https://www.youtube.com/playlist?list=PLO2l2fYgN805uI-sDXvo0jV6qvXWHi6x8
---------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------

#readcsv
#java
#csvreader

Tags and Topics

Browse our collection to discover more content in these categories.

Video Information

Views

680

Likes

33

Duration

4:37

Published

Mar 10, 2023

Related Trending Topics

LIVE TRENDS

Related trending topics. Click any trend to explore more videos.

Trending Now