# Hide Rows and Columns

Learn how to hide or show rows and columns in a worksheet with sample codes using DsExcel.

## Content





You can choose whether to hide or show rows and columns in a worksheet by using the [setHidden](/document-solutions/java-excel-api/api/online/com/grapecity/documents/excel/IRange.html#setHidden) method of the [IRange](/document-solutions/java-excel-api/api/online/com/grapecity/documents/excel/IRange.html) interface.

Refer to the following example code in order to hide specific rows and columns in a worksheet.

```Java
worksheet.getRange("E1").setValue(1);

// Hide row 2:6 using the setHidden method.
worksheet.getRange("2:6").setHidden(true);

// Hide column A:D using the sethidden method.
worksheet.getRange("A:D").setHidden(true);
```