Reputation: 3459
A C# code that loops through a excel file and lists the Excel table/tab on to a message boxs.
Upvotes: 0
Views: 1945
Reputation: 144
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
Upvotes: 2
Reputation: 54999
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).
Upvotes: 1