title: Getting error as " org.apache.poi.hssf.usermodel.HSSFRow cannot be cast to org.apache.poi.ss.usermodel.Row"
body: <p>I am writing java code to read excel file having column name "Key" and "Value". But getting error as unable to cast at this line of code, </p>
  
  <p>Row firstRow =(Row)sheet.getRow(0);</p>
  
  <p>How to resolve this error please help me.</p>
  
  <pre><code>public static void main(String[] args) throws Exception {       
  FileInputStream fileIn = new FileInputStream("c://param_2003.xls");
  POIFSFileSystem fs = new POIFSFileSystem(fileIn); 
  HSSFWorkbook filename = new HSSFWorkbook(fs);
  HSSFSheet sheet = filename.getSheetAt(0);
  
  String column1 = "Key";
  String column2 = "Value";
  Integer columnNo1 = null;
  Integer columnNo2 = null;
  List&lt;Cell&gt; cells = new ArrayList&lt;Cell&gt;();
  Row firstRow =(Row)sheet.getRow(0);
  
  for(org.apache.poi.ss.usermodel.Cell cell:firstRow){
      if (cell.getStringCellValue().equals(column1)){
          columnNo1 = cell.getColumnIndex();
      }
  }
  
  for(org.apache.poi.ss.usermodel.Cell cell:firstRow){
      if (cell.getStringCellValue().equals(column2)){
          columnNo2 = cell.getColumnIndex();
      }
  }
  System.out.println(columnNo1);
  System.out.println(columnNo2);
  
  }
  </code></pre>