[Python] What is the best way to copy a column's conditional formatting?

Discussão em 'Python' iniciado por Stack, Março 19, 2025.

  1. Stack

    Stack Membro Participativo

    I am generating an Excel report using Python. I have a "template" report that uses conditional formatting for various cells. What is the best way to copy all the formatting from, say, column A (which could be different in different cells/rows) to column D within a given sheet?

    (I'm assuming we are using openpyxl but am game to other mac-friendly options)

    Basically I want a function that is:

    def copy_formatting(openpyxl_sheet, from_col, to_col):
    .... magic happens here ....
    return openpyxl_sheet

    Continue reading...

Compartilhe esta Página