How to save XLSM file with Macro, using openpyxl

后端 未结 6 1354
一个人的身影
一个人的身影 2020-11-29 11:32

I have .xlsm file with a Macro function. I\'m loading it using openpyxl and write some data to the file and finally want t

6条回答
  •  自闭症患者
    2020-11-29 11:59

    For me this worked, together with version openpyxl==2.3.0-b2

    wb = load_workbook(filename='original.xlsm', read_only=False, keep_vba=True)
    ..
    wb.save('outfile.xlsm')
    

    It is also mentioend in the documentation here: http://openpyxl.readthedocs.org/en/latest/usage.html?highlight=keep_vba#write-a-workbook-from-xltm-as-xlsm

提交回复
热议问题