Search code examples
javacsvopencsv

How to extract and display specific rows from CSV file in java?


I want data to be extracted based on user input. Program asks for date input from user and based on that input all the records having that date should be fetched. How to do that?


Solution

  • CSV files are just comma separated files. So you can read the csv file like any other file using the Reader class and then use the split function to seperate the columns.

    First, you can read the file and store it in 2-D string array. And then filter the records according to the user input.