Like plenty of others, I use openpyxl to do a bunch of data parsing and then dump it to an excel file as output for others.
My relevant blob looks like this:
output_xlsx = 'my_data.xlsx'
dataTables = build_datatables(snapshot_filenames, formatsToBuild)
output_book = bookFromTables(dataTables.values(), dataTables.keys())
log.info(f"writing output data to {output_xlsx}")
output_book.save(output_xlsx)
What I can't figure out yet is what is expected to happen when this gets run but the my_data.xlsx file is currently open in Excel.
I would have expected either an OSError of some flavor saying something along the lines of "I can't write to that file, it's open!" or "I can't open this file because someone else has it" or something along those lines... but in my case the .save() call executes, returns with no errors/exceptions, but the file itself is NOT updated or changed, it just sits happily still open in Excel.
For my particular use case I don't think I have a strong opinion as to what happens OTHER than a "silent execution that appears to have saved something but doesn't actually save anything"
In case it's relevant, this is running openpyxl 3.1.2 in WSL2 on a windows 11 machine with whatever the current version of Excel/Office365 is.