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
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.