import copy
def copy_sheet(source_sheet, dest_workbook):
dest_sheet = dest_workbook.create_sheet(title=source_sheet.title, index=0)
for col_index, col_dimens in source_sheet.column_dimensions.items():
width = col_dimens.width
if int(width) == 0:
continue
dest_sheet.column_dimensions[col_index].width = width
for merge_cell in source_sheet.merged_cells.ranges:
dest_sheet.merge_cells(str(merge_cell))
for i, row in enumerate(source_sheet.rows):
dest_sheet.row_dimensions[i+1].height = source_sheet.row_dimensions[i+1].height
for cell in row:
new_cell = dest_sheet.cell(row=cell.row, column=cell.column,value= cell.value)
if 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)