How to read CSV file in JAVA

Here is a csv file whose given data are shown below


 package com.demo;
 import java.io.BufferedReader;
 import java.io.FileReader;
 public class UploadCsv {

    public static void main(String[] args) throws Exception {

        String splitBy = ",";
        String cv = "C:/Users/Dheeraj/Desktop/pRACTICE/Book1.csv";
        BufferedReader br = new BufferedReader(new FileReader(cv));
        String line = br.readLine();
        while ((line = br.readLine()) != null) {
            String[] b = line.split(splitBy);
            System.out.println(b[0] + " " + b[1] + " " + b[2]);
        }
        br.close();

    }
 }

More Links :
How to Upload CSV file in JAVA
Download data from mysql db to csv file using java
Export data from mysql db to csv file using java 

Comments

Popular posts from this blog

Secure Database Connectivity in node.js with mysql

Export data from mysql db to csv file using java

API (Application Programming Interface)