I am using python 3.8.1 on a mac and am trying to create a .xlsm file from scratch. I have looked at openpyxl and xlsxwriter, both of them are able to create
It appears as though an XLSM file is a zipped Excel file, containing macros, etc.
I was able to find a potential fix here using openpxyl:
import openpyxl as px
from openpyxl import load_workbook
import os
...
wbname='orig_fname.xlsm'
wb = load_workbook(filename=wbname, keep_vba=True)
...
wb.save('temp.xlsm')
os.rename('temp.xlsm', wbname)
Please let me know if it works for you.