file not found exception when trying to read sample excel sheet data

366 views
Skip to first unread message

Ram

unread,
Aug 25, 2016, 2:15:10 AM8/25/16
to Selenium Users
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();
}
}
}

Panikera Raj

unread,
Aug 25, 2016, 2:45:25 AM8/25/16
to selenium-users
Hi Ram,

The exception is telling clearly that Not able to find the file path. try to give exact path, probably it will work,

if not working write in some other forum which is related to Java or Excel API, Here you can post only WebDriver related quires 

-Panikera





--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/96b8db52-086e-488d-8703-b787418b5638%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

⇜Krishnan Mahadevan⇝

unread,
Aug 25, 2016, 2:45:50 AM8/25/16
to Selenium Users
Ram,

Your issue has got nothing to do with Selenium WebDriver.

Please help keep this forum relevant by posting queries that are ONLY related to Selenium WebDriver.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

On Thu, Aug 25, 2016 at 11:45 AM, Ram <ramk...@gmail.com> wrote:

--
Reply all
Reply to author
Forward
0 new messages