title: Invalid Header Signature - Opening XLS with Apache POI
body: <p>I'm trying to convert a XLS file into a CSV file in java using Apache POI 3.9, however I'm getting some issues. When trying to convert the file I need to, it shows me the following error:</p>
  
  <pre><code>java.io.IOException: Invalid header signature; read 0x0010000000080209, expected 0xE11AB1A1E011CFD0
      at org.apache.poi.poifs.storage.HeaderBlock.&lt;init&gt;(HeaderBlock.java:140)
      at org.apache.poi.poifs.storage.HeaderBlock.&lt;init&gt;(HeaderBlock.java:104)
      at org.apache.poi.poifs.filesystem.POIFSFileSystem.&lt;init&gt;(POIFSFileSystem.java:138)
      at ExtractExcelToCSV.convertExcelToCsv(ExtractExcelToCSV.java:26)
      at ExtractExcelToCSV.main(ExtractExcelToCSV.java:60)
  </code></pre>
  
  <p>I think the code I'm using is completely correct (and it also works with other files). I think the problem is on XLS file because when I try to open it using MS Excel it also shows me a warning about the file type (it says it is a MS Excel 3 Worksheet). Is there any way I can open these files using POI? </p>
  
  <pre><code>public static void convertExcelToCsv() throws IOException {
          try {
              cellGrid = new ArrayList&lt;List&lt;HSSFCell&gt;&gt;();
              FileInputStream myInput = new FileInputStream("D:\\...\\filename.xls");
  
  
  
              POIFSFileSystem myFileSystem = new POIFSFileSystem(myInput);
              HSSFWorkbook myWorkBook = new HSSFWorkbook(myFileSystem);
              HSSFSheet mySheet = myWorkBook.getSheetAt(0);
              Iterator&lt;?&gt; rowIter = mySheet.rowIterator();
  
              while (rowIter.hasNext()) {
                  HSSFRow myRow = (HSSFRow) rowIter.next();
                  Iterator&lt;?&gt; cellIter = myRow.cellIterator();
                  List&lt;HSSFCell&gt; cellRowList = new ArrayList&lt;HSSFCell&gt;();
                  while (cellIter.hasNext()) {
                      HSSFCell myCell = (HSSFCell) cellIter.next();
                      cellRowList.add(myCell);
                  }
                  cellGrid.add(cellRowList);
              }
          } catch (FileNotFoundException e) {
              e.printStackTrace();
          }
  </code></pre>