code: @Nullable
    public static Workbook readWorkbookFromInputStream (@Nonnull final IHasInputStream aIIS)
    {
      InputStream aIS = null;
      try
      {
        // Try to read as XLS
        aIS = aIIS.getInputStream ();
        if (aIS == null)
        {
          // Failed to open input stream -> no need to continue
          return null;
        }
        return new HSSFWorkbook (aIS);
      }
      catch (final OfficeXmlFileException ex)
      {
        // No XLS -> try XSLS
        StreamHelper.close (aIS);
        try
        {
          // Re-retrieve the input stream, to ensure we read from the beginning!
          aIS = aIIS.getInputStream ();
          return new XSSFWorkbook (aIS);
        }
        catch (final IOException ex2)
        {
          LOGGER.error ("Error trying to read XLSX file from " + aIIS, ex);
        }
      }
      catch (final NotOLE2FileException ex)
      {
        LOGGER.error ("Error trying to read non-Excel file from " + aIIS + ": " + ex.getMessage ());
      }
      catch (final IOException ex)
      {
        LOGGER.error ("Error trying to read XLS file from " + aIIS, ex);
      }
      finally
      {
        // Ensure the InputStream is closed. The data structures are in memory!
        StreamHelper.close (aIS);
      }
      return null;
    }
docs: Try to read an Excel {@link Workbook} from the passed
  {@link IHasInputStream}. First XLS is tried, than XLSX, as XLS files can be
  identified more easily.
  
  @param aIIS
  The input stream provider to read from.
  @return <code>null</code> if the content of the InputStream could not be
  interpreted as Excel file