Answers for "copy cell style openpyxl"

0

copy cell style openpyxl

def copy_last_cell_Style(new_cell, cell):

    if cell.has_style:
        print("Cell has style")
        new_cell.font = copy(cell.font)
        new_cell.border = copy(cell.border)
        new_cell.fill = copy(cell.fill)
        new_cell.number_format = copy(cell.number_format)
        new_cell.protection = copy(cell.protection)
        new_cell.alignment = copy(cell.alignment)
    return new_cell
  
 copy_last_cell_Style(WS[f"a{WS.max_row}"],
                                 WS[f"a{WS.max_row - 1}"])
Posted by: Guest on September-30-2021

Python Answers by Framework

Browse Popular Code Answers by Language