I managed to create an Excel file and add VBA project to it using Xlsxwriter and I managed to write dataframes to an Excel using pandas to_excel method.
But I can't combine the two. It seems both methods write a fresh Excel file, so either I end up with a empty Excel fill with the VBA (Pandas to_excel first then Xlsxwriter's add_vba_project) or I end up with the data I want but no VBA (Xlsxwriter's add_vba_projet first and then Pandas to_excel)
Any thoughts on this? Obvious way around this would be to write evrything using Xlsxwriter somehow, but I already spent so much time getting the Pandas to_excel to work the way I wanted that I'd rather avoid that.
Once this gets solved I just need something that changes the filename from .xlsx to .xlsm, but that should be easy right.