hi ,
below is my simple code to read data from excel sheet,
some how getting file not found exception even though i have given the correct path and verified the file exists.
java.io.FileNotFoundException: C:\Users\trilogy\datasheet.xlsx (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at com.java.utilities.ExcelManager.main(ExcelManager.java:67)
please help...
public class ExcelManager {
public static void main(String[] args) {
XSSFWorkbook ExcelWBook;
XSSFSheet ExcelWSheet;
XSSFCell Cell;
// Location of the Excel file
String path = "C://Users//trilogy//datasheet.xlsx";
String sheetName = "Sheet1";
try {
FileInputStream ExcelFile = new FileInputStream(path);
ExcelWBook = new XSSFWorkbook(ExcelFile);
ExcelWSheet = ExcelWBook.getSheet(sheetName);
Cell = ExcelWSheet.getRow(1).getCell(2);
String cellData = Cell.getStringCellValue();
System.out.println("Cell Data: " + cellData);
} catch (Exception e) {
e.printStackTrace();
}
}
}