Excelのシート名の一覧を出力する
string excelPath =
@"C:\hoge.xls";
Excel.Application xlsApplication =
new Excel.Application();
Excel.Workbooks xlsBools = xlsApplication.Workbooks;
xlsBools.Open(excelPath, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing);
Excel._Workbook book = xlsBools.get_Item(
1);
Excel.Sheets sheets= book.Worksheets;
Excel._Worksheet sheet;
for (
int i =
1; i <= sheets.Count; ++i)
{
sheet = (Excel._Worksheet)sheets.get_Item(i);
System.Console.WriteLine(sheet.Name);
}