Created
April 11, 2012 13:55
-
-
Save fornext1119/2359450 to your computer and use it in GitHub Desktop.
Python で Excel のシート名一覧を出力
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: cp932 | |
import win32api, win32con, win32com, win32com.client, os, time, sys | |
excelApp = win32com.client.Dispatch("Excel.Application") | |
excelApp.Visible = True | |
excelApp.DisplayAlerts = False #警告メッセージをOFF | |
#ブックを読み取り専用で開く | |
book = excelApp.workbooks.open(sys.argv[1], False, True) | |
for sheet in book.Worksheets: | |
print sheet.name | |
book.Close() | |
excelApp.Quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment