Now lets create a class file, for assessing the data in the excel using the Apache poi classes and methods.
Code
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFSheet;
public class dataDriven {
public static void main(String args[]) throws IOException {
FileInputStream fis = new FileInputStream("'D://Apache_poi_data_01.xlsx");
XSSFWorkbook workbook = new XSSFWorkbook(fis);
int sheet = workbook.getNumberOfSheets();
for (int i = 0; i<sheet;i++) {
if(workbook.getSheetName(i).equalsIgnoreCase("Sheet1")) {
XSSFSheet sheets = workbook.getSheetAt(i);
}
}
}
}
Explanation
I