Guest User

Untitled

a guest
Sep 26th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. # coding: cp932
  2. import win32api, win32con, win32com, win32com.client, os, time, sys
  3.  
  4. excelApp = win32com.client.Dispatch("Excel.Application")
  5. excelApp.Visible = True
  6. excelApp.DisplayAlerts = False #警告メッセージをOFF
  7.  
  8. #ブックを読み取り専用で開く
  9. book = excelApp.workbooks.open(sys.argv[1], False, True)
  10. for sheet in book.Worksheets:
  11. print sheet.name
  12.  
  13. book.Close()
  14. excelApp.Quit()
Add Comment
Please, Sign In to add comment