public static XSSFWorkbook loadWorkbook(final File file) {
        final String name = file.getName();

        if (name.endsWith(".xlsx")) {
            try {
                return new XSSFWorkbook(file);
            }
            catch (final Exception e) {
                throw new IllegalArgumentException("Could not open file " + file, e);
            }
        }

        throw new IllegalArgumentException("Unknown file type: " + file);
    }
Tries to open a {@link File} as XLSX and XLS.

@param file The {@link File} to open.
@return The opened workbook.
primefaces-integration-tests/src/test/java/org/primefaces/integrationtests/dataexporter/AbstractDataExporterTest.java