-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreadExcel_1.java
More file actions
37 lines (28 loc) · 949 Bytes
/
Copy pathreadExcel_1.java
File metadata and controls
37 lines (28 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main.java.excelReading;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.io.FileInputStream;
import java.io.IOException;
/**
* Created by neeraj.bhatnagar on 1/17/2017.
*/
public class readExcel_1 {
String path;
FileInputStream fis;
XSSFWorkbook workbook;
XSSFSheet sheet;
public readExcel_1(String path) throws IOException {
this.path = path;
FileInputStream fis = new FileInputStream(path);
workbook = new XSSFWorkbook(fis);
}
public void getCellData(){
sheet = workbook.getSheet("userData");
System.out.println(sheet.getRow(1).getCell(1).getStringCellValue());
}
public static void main(String[] args) throws IOException {
String path = System.getProperty("user.dir")+"\\testdata\\testData.xlsx";
readExcel_1 obj = new readExcel_1(path);
obj.getCellData();
}
}