これは先週働いていましたが、何らかの理由で今日の仕事が止まってしまいました。win32com Excel.Applicationはもうドキュメントを開くことができません
def remove_strikethroughs(xlsx):
excel = win32com.client.Dispatch('Excel.Application')
xl = pd.ExcelFile(xlsx)
sheet_names = xl.sheet_names
for sheet in sheet_names:
if any(tab in sheet for tab in tabs_used):
#print (sheet)
wb = excel.Workbooks.Open(xlsx)
ws = wb.WorkSheets(sheet)
for cell in ws.Range('A5:B150'):
if cell.Font.Strikethrough == True:
cell.value = '[MDU]' + str(cell)
wb.Save()
wb.Close()
excel.Visible = True
excel.DisplayAlerts = True
excel.Application.Quit()
私は、次のエラーメッセージが出ます:
"AttributeError: '<win32com.gen_py.Microsoft Excel 15.0 Object Library.Workbooks instance at 0x20920640>' object has no attribute 'open'"
は、誰かが助けてくださいことはできますか?
ありがとうございます!
どこにでも小文字の "open"を呼び出す必要はありません。使用しているコードを投稿してもよろしいですか? – Schollii