I found this issue while working on the copy worksheet functionality and wanted to log it.
I started with conditionalFormattingStart.xlsx. I created two conditional formatting rules. One for sheet one and one for sheet two. Both of these rules used different background color to highlight the items. When I ran the below code it produced conditionalFormattingEnd.xlsx. You will see that the background color of the conditionally formatted range has changed on sheet2.
from openpyxl import load_workbook wb = load_workbook("bug590.xlsx") wb.save("bug590-23.xlsx")
Here is what I noticed if you look a the sheet you see two different conditional format colors. One on the first tab on one the second. If I run the above script on that workbook, you get two workbooks but both of them are the same and the color from tab one has been moved to tab two. So it appears that the save method might be saving to both workbooks aswell as something is changing the style of the second conditional format.