How to delete worksheets with aspose cells

How to delete a worksheet from xlsx file with aspose cells.
Here’s my code:

Workbook workbook = new Workbook(getFileStream())
workbook.getWorksheets().setActiveSheetIndex(0)
String worksheetName = workbook.worksheets.get(i).name
if (worksheetName.startsWith("_")){
// This works perfectly so, do nothing
}else {
// I want to delete other worksheets for else condition
}

Please help.

@girisagar46,

You may use WorksheetCollection.removeAt() method for your needs. See the following code segment for your reference:
e.g
Sample code:

.........
for (int i = workbook.getWorksheets().getCount - 1; i >= 0; i--)
{

    String worksheetName = workbook.getWorksheets().get(i).getName();
	if (worksheetName.startsWith("_")){
	// This works perfectly so, do nothing
	}
	else {
	// I want to delete other worksheets for else condition
        workbook.getWorksheets().removeAt(i);
	}

}

Hope, this helps a bit.