check if a sheet exists in excel
- by ps
How do i check if a sheet exists in a excel using interop. I tried the following but it throws an COMException if not there.. Is there a better way of finding out than actually looking at the exception
Worksheet sheet = null;
Sheets worksheets = some;
sheet = (Worksheet)worksheets.get_Item("sheetName");
if(sheet!=null)
{
//do something
}