I have been trying for a few days to programmatically add a Sensitivity Label to my Excel file using Python. I was able to do it using xlwings
on Windows, but my RHEL9 container didn’t work. I tried following the instructions in Setting sensitivity label for excel file using python. The xlwings
version worked (on windows), but the workbook for the xslxwriter
example, after using “set_custom_property” would no longer open with any content.
I looked at the unzipped excel xml files for “Before” and “After” adding manually or using xlwings
and neither of them have the custom.xml file referenced in the xslxwriter
example of the above link answer.
I’m looking for an example of how to do this using python only that’ll work with Python 3.8+ on RHEL7 – RHEL9. Any suggestions?
The xlwings
on Windows example from Setting sensitivity label for excel file using python worked. I tried just creating a LabelInfo.xml file in the docMetadata folder of the unzipped Excel file, but that didn’t produce the expected results. Comparing the unzipped files, it looks like xlwings
actually touches a bunch of files.
Jim Palmer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.