CsvToBean and BeanToCsv Example – Using OpenCSV

In my previous article we have learnt how to read/write a csv file using OpenCSV, in both Reading a CSV file and Exporting data to CSV File we just displayed the output in the console. In case of saving/retrieving the data that method will not be helpful and we will be needing the support of Object Oriented Concept (A bean for holding the values). In this example we will learn how to parse a csv file and save data to a bean and vice-versa(bean to csv file). [Read more…]

How to Read/Parse/Write CSV File using OpenCSV

CSV stands for Comma Seperated Values, it is the popular format used for import and exporting of data. Java by default doesn’t provide a parser for CSV hence at the end we will end up writing up a parser. OpenCSV is a third party library which can effecitively handle a CSV file. In this article we will learn how to read a CSV file and how to write data to a CSV file using OpenCSV.
[Read more…]

How to read and parse CSV file in Java

CSV stands for Comma Seperated Values. A CSV file is used for data storage, it looks like a normal text file containing organised information seperated by a delimiter Comma. There are many ways of Reading and Parsing a CSV file, in this example we will look into the below three methods

  1. Using BufferedReader and String.split()
  2. Using Scanner of Java Util package
  3. Using 3rd party library like OpenCSV

[Read more…]