I am looking for a way to identify if an Excel sheet is a WorkSheet or a ChartSheet, in the below when it executes the last line, it will throw an exception if the sheet is a ChartSheet. Is there a way to identify the type of sheet using the Sheet.Id?
Using SDocument As SpreadsheetDocument = SpreadsheetDocument.Open(filename, False)
Dim workbookPart As WorkbookPart = SDocument.WorkbookPart
workbookPart.Workbook.Descendants(Of Sheet)()
For Each Sheet As Sheet In SDocument.WorkbookPart.Workbook.Sheets
Try
Dim sID As String = Sheet.Id
Console.WriteLine(sID)
Dim part As WorksheetPart = workbookPart.GetPartById(sID)