Suppose you are using the XSSF API for .xlsx excel files. If tables were created using Insert->Table , you can read them using the following:
XSSFWorkbook workbook = new XSSFWorkbook(new File("test.xlsx")); int numberOfSheets = workbook.getNumberOfSheets(); for(int sheetIdx = 0; sheetIdx < numberOfSheets; sheetIdx++) { XSSFSheet sheet = workbook.getSheetAt(sheetIdx); List<XSSFTable> tables = sheet.getTables(); for(XSSFTable t : tables) { System.out.println(t.getDisplayName()); System.out.println(t.getName()); System.out.println(t.getNumerOfMappedColumns()); } }
If by table you mean everything that has a border, then you need to create a nontrivial algorithm that reads all the cells of each sheet and checks the borders (for example, leftBorderColor , rightBorderColor , topBorderColor , bottomBorderColor ) and determines what consists of checking the table if you found her.
alkis source share