You've said in the comments that the line giving the NPE is:
Iterator<Row> rowIter = mySheet.rowIterator();
Your problem is that you're not checking if the sheet you tried to fetch really existed. If you try to fetch a sheet with an invalid name, you'll get back null. From the Workbook JavaDocs:
Returns: Sheet with the name provided or null if it does not exist
So, your code should then be something more like:
HSSFSheet mySheet= myWorkBook.getSheet(sheetname);
if (mySheet == null) {
throw new IllegalArgumentException("No sheet exists with name " + sheetName);
}
Alternately, return null from your code there, and check for that in your calling code (rather than catching the exception).
If you're not sure what Sheets your Workbook really has (which might not be what you thought in the odd case), try:
for (int sn=0; sn < myWorkBook.getNumberOfSheets(); sn++) {
System.out.println("Sheet " + sn + " is called " + myWorkBook.getSheetName(sn));
}