Conditional Formatting Issue

Issue #590 invalid
Donald Freeman
created an issue

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.

Comments (8)

  1. Donald Freeman reporter

    Yea I noticed that the other day. I uploaded the wrong file. I started with the colors different, ran the script, and it made them the same. So the first sheet should show different colors. I will upload the right file next time I am at my computer.

  2. CharlieC

    I see the same colour, red, in both worksheets. It seems to me that there should be two files one with the original "pristine" formatting from Excel, and another after this has been processed by openpyxl. Possibly add screenshots to highlight what you think the problem is.

  3. Log in to comment