# Create and Delete Tables

Learn how easily you can create and delete tables in a spreadsheet using DsExcel.

## Content





In DsExcel Java, you can create and delete tables in spreadsheets using the [add](/document-solutions/java-excel-api/api/online/com/grapecity/documents/excel/ITables.html#add) method of the [ITables](/document-solutions/java-excel-api/api/online/com/grapecity/documents/excel/ITables.html) interface and the [delete](/document-solutions/java-excel-api/api/online/com/grapecity/documents/excel/ITable.html#delete) method of the [ITable](/document-solutions/java-excel-api/api/online/com/grapecity/documents/excel/ITable.html) interface, or simply transform a cell range into a table by specifying the existing data lying in a worksheet.

In order to create and delete tables in a worksheet, refer to the following example code.

```Java
//Create workbook and access the worksheet
Workbook workbook = new Workbook();
IWorksheet worksheet = workbook.getWorksheets().get(0);
        
// Add first table
ITable table1 = worksheet.getTables().add(worksheet.getRange("A1:E5"), true);
        
// Add second table
ITable table2 = worksheet.getTables().add(worksheet.getRange("N1:R5"), true);

// Delete first table
worksheet.getTables().get(0).delete();
```


> !type=note
>
> **Note**: DsExcel also supports defined names, which can be used to name the table. For more information, see [Defined Names](/document-solutions/java-excel-api/docs/online/Features/DefinedNames).
