How to save XLSM file with Macro, using openpyxl

后端 未结 6 1379
一个人的身影
一个人的身影 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:51

    That's right, openpyxl cannot read and write VBA code.

    According to this thread:

    I think you should not give the xlsM extension, because the file will contain no VBA code. openpyxl is used to build xlsX files only.

    Give a try to this fork instead: if you pass keep_vba=True parameter to load_workbook it should do the job.

    Hope that helps.

提交回复
热议问题