我希望将A.xls文件转换为B.xlsm文件“ sheet2”,并在B.xlsm中执行宏并保存
所以我尝试
writer = win32com.client.Dispatch("Excel.Application") #load to macro
writer = pd.ExcelWriter("B.xlsm", engine = 'openpyxl') #load to write
writer.book = load_workbook("B.xlsm",keep_vba=True)
df = pd.read_excel("A.xls")
df.to_excel(writer, sheet_name='Sheet1)
writer.Application.Run("addValue")
writer.save()
writer.close()
,但没有错误: AttributeError:“ _ OpenpyxlWriter”对象没有属性“ Application”
这两个任务怎么办?