Question: I need help in writing a C# code which basically should take excel file as input and check if the excel file contains a specific worksheet or tab and if yes rename that tab with another name. The program should support .net 3.5 and excel 2007. Please provide me some examples. Thanks in advance.

Answer: 
```
Application excel = new Application();
Workbook wb = excel.Workbooks.Open(path, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);

    string lookFor="TabName1";

    foreach (Microsoft.Off.Interop.Excel.Worksheet w in wb.Worksheets)
     {
       if (w.Name == lookFor)
         //match exists rename
         w.Name = lookFor + "_renamed";
     }

```
[Full length code From one of the stack over posts](https://stackoverflow.com/questions/1526685/c-how-can-i-open-and-close-an-excel-workbook/ "Perfect Answer")