Adding XML Source to xlsx file in python

I am trying to create a xlsx from a template exported from Microsoft dynamics NAV, so I can upload my file to the system.

I am able to recreate and fill the template using the library xlsxwriter, but unfortunately I have figured out that the template file also have an attached XML source code file(visible in the developer tab in Excel).

I can easily modify the XML file to match what I want, but I can't seem to find a way to add the XML source code to the xlsx file. I have searched for "python adding xlsx xml source" but it doesn't seem to give me anything I can use.

Any help would be greatly appreciated.

Best regards Martin


  • Xlsx file is basically a zip archive. Open it as archive and you'll probably be able to find the XML file and modify it. – Mak Sim yesterday