Let's say I have one workbook which is having 6 sheets as Sheet1, Sheet2, Sheet3, Sheet4, Sheet5, Sheet6.
So from here I want to delete Sheet1, Sheet2, Sheet3. How can I do that?
You can call the .Delete() method, like that:
Globals.Sheet1.Delete();
Update, according your comment:
Excel._Worksheet ws = (Excel._Worksheet)app.Workbooks[i].Worksheets[j];
ws.Delete();
I hope this code will help you:
app.DisplayAlerts = false;
worksheet.Delete();
app.Displayalerts = true;
where app is your XlsApplication.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With