Free Support Forum - aspose.com

How to delete an Excel Worksheet

I see calls to delete a Row or a Column, is there a way to delete an entire worksheet from the worksheet collection?

Thanks,

Mohan

Hi,

Thanks for your interest in Aspose.Cells for Java.

Yes, please use these methods of

Class Worksheets

void removeSheet(int index)
Removes the sheet at the specified index.
boolean removeSheet(java.lang.String sheetName)
Removes the specified sheet from the workbook.
boolean removeSheet(Worksheet sheet)
Removes the specified worksheet.

For further reference, please visit this link.
Worksheets

I don’t see removeSheet in the .NET, is this supported only in Java?

Hi,

Please see the document for your reference on how to delete worksheets:
Manage Worksheets

thank you.

Hi,

In .NET, you can use the following code to remove the worksheet.


//remove first sheet inside the collection

int yourSheetIndex = 0;

workbook.Worksheets.RemoveAt(yourSheetIndex);



This works. Thanks!