Deleting Excel WorkSheet using C#
You can delete any worksheet from Microsoft Excel file. In order to delete a worksheet, you must add a reference to the Microsoft.Office.Interop.Excel assembly, and then you must use classes from that assembly to open a workbook and delete a worksheet.The following program shows how to delete worksheet from an an existing Excel file using C#.
To access the object model from Visual C# .NET, you have to add the Microsoft Excel 12.0 Object Library to you project. In the previous chapter you can see a step by step instruction on how to add Excel library to your project.
Delete worksheet from an excel file
In order to delete worksheet from excel file, this program open an existing Excel file and select the worksheet and then delete it.
Delete Excel.Worksheet without prompts
DisplayAlerts set to False for suppress prompts and alert messages while a macro is running. When a message need a response from the end user, Microsoft Excel chooses the default response. After you complete the running process, Microsoft Excel sets this property to True, unless you are running cross-process code.
The following source code shows how to programmatically delete Worksheets from Workbooks.
- How to create Excel file in C#
- How to open an Excel file in C#
- How to read an Excel file using C#
- How to programmatically Add New Worksheets
- How to format an Excel file using C#
- How to insert a picture in excel from C# App
- How to insert a background picture in excel
- How to create Excel Chart from C#
- How to export excel chart from C#
- How to excel chart in C# picturebox
- C# data validation input box in excel file
- Read and Import Excel File into DataSet or DataTable
- How to insert data to Excel file using OLEDB
- How to update data in Excel file using OLEDB
- How to export databse to excel file
- How to export DataGridView to excel file