Below is a code snippet for reading a specific cell from Excel using Java.
It is done by using importing jxl jar files which can be found here.
Import below in class file
import jxl.Cell; import jxl.Sheet; import jxl.Workbook; import jxl.format.Colour; import jxl.read.biff.BiffException; import jxl.write.*; Below is function for reading value from specific cell in Excel
public String readexcel(String sheet, int intRow, int intCol){ try { //Create a workbook object from the file at specified location. //Change the path of the file as per the location on your computer. Workbook wrk1 = Workbook.getWorkbook(new File(dataPath)); //Obtain the reference to the first sheet in the workbook Sheet sheet1 = wrk1.getSheet(sheet); //Obtain reference to the Cell using getCell(int col, int row) method of sheet // Add " - 1" to both intRow , intCol depending how whether we consider excel start with row & column number as 0 or 1 Cell colArow1 = sheet1.getCell(intRow , intCol ); //Read the contents of the Cell using getContents() method, which will return //it as a String String strReturn = colArow1.getContents(); return strReturn; /* //Display the cell contents System.out.println("Contents of cell Col A Row 1: \""+str_colArow1 + "\""); System.out.println("Contents of cell Col B Row 1: \""+str_colBrow1 + "\""); System.out.println("Contents of cell Col A Row 2: \""+str_colArow2 + "\"");*/ } catch (BiffException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return sheet; } Below is an example of how to read from a cell based on row number and Column NAME
...