Below statement reads the data from 'sample.csv' file and create a table from it.
Table table = Table.read().csv("sample.csv");
1,Hari Krishna,Gurram
2,Kiran Kumar,Darsi
3,Rama Krishna,Gurram
4,Gopi,Battu
5,Sudheer,Ganji
App.java
package com.sample.app;
import java.io.IOException;
import tech.tablesaw.api.Table;
public class App {
public static void main(String args[]) throws IOException {
String csvFilePath = "/Users/krishna/Documents/employee.csv";
Table table = Table.read().csv(csvFilePath);
System.out.println(table.print());
}
}
Output
employee.csv
1 | Hari Krishna | Gurram |
---------------------------------
2 | Kiran Kumar | Darsi |
3 | Rama Krishna | Gurram |
4 | Gopi | Battu |
5 | Sudheer | Ganji |
No comments:
Post a Comment