A C# code that loops through a excel file and lists the Excel table/tab on to a message box开发者_如何学Cs.
I like to work with Linq To Excel when I can. There is actually a function that gets just the sheet names:
Query Worksheet Names The GetWorksheetNames() method can be used to retrieve the list of worksheet names in a spreadsheet.
var excel = new ExcelQueryFactory("excelFileName");
var worksheetNames = excel.GetWorksheetNames();
http://code.google.com/p/linqtoexcel/wiki/UsingLinqToExcel
Here's a code project article that will show you how to retrieve all sheet names from an Excel workbook (I assume this is what you mean with tab).
C# - Retrieve Excel Workbook Sheet Names.
Edit: Not sure if the above would get you range (table) names as well, but otherwise you could probably do that if you're using Excel Interop by looping through workBook.Names
and then checking the RefersToRange
property of each name (which would return an error if it's not a range).
精彩评论