Answers for "csv file java"

-1

Reading CSV file in java

public class ParseCSV {
  public static void main(String[] args) {
    try {
      //csv file containing data
      String strFile = "C:/Users/rsaluja/CMS_Evaluation/Drupal_12_08_27.csv";
      CSVReader reader = new CSVReader(new FileReader(strFile));
      String [] nextLine;
      int lineNumber = 0;
      while ((nextLine = reader.readNext()) != null) {
        lineNumber++;
        System.out.println("Line # " + lineNumber);

        // nextLine[] is an array of values from the line
        System.out.println(nextLine[4] + "etc...");
      }
    }
  }
}
Posted by: Guest on July-27-2021
0

csv file data structure java

HashMap<String, List<String>>
//csv file has 3 columns first column can be used as key
Posted by: Guest on October-20-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language