package [Link].
utilities;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class ReadExcelFile {
public static FileInputStream inputStream;
public static XSSFWorkbook workBook;
public static XSSFSheet excelSheet;
public static XSSFRow row;
public static XSSFCell cell;
public static String getCellValue(String fileName, String sheetName, int rowNo, int
cellNo/*column no.*/)
try
inputStream = new FileInputStream(fileName);
workBook = new XSSFWorkbook(inputStream);
excelSheet = [Link](sheetName);
cell = [Link](sheetName).getRow(rowNo).getCell(cellNo);
[Link]();
return [Link]();
catch (Exception e)
return "";
public static int getRowCount (String fileName, String sheetName)
try
inputStream = new FileInputStream(fileName);
//create XSSFWorkBook Class object for excel file manipulation
workBook = new XSSFWorkbook(inputStream);
excelSheet = [Link](sheetName);
//get total no. of rows
int ttlRows = [Link]() + 1;
[Link]();
return ttlRows;
catch (Exception e)
return 0;
public static int getColCount (String fileName, String sheetName)
try
{
FileInputStream inputStream = new FileInputStream(fileName);
//create XSSFWorkBook Class object for excel file manipulation
XSSFWorkbook workBook = new XSSFWorkbook(inputStream);
XSSFSheet excelSheet = [Link](sheetName);
//get total no. of columns
int ttlCells = [Link](0).getLastCellNum();
[Link]();
return ttlCells;
catch (Exception e)
return 0;