Images dissapear in excel documents when copying them with python

I had the same issue and tried a lot of libs. For me editpyxl does exactly what I need in that scenario:

import editpyxl

wb = editpyxl.Workbook()  
source_filename = r'Template.xlsx'
destination_filename = 'Output.xlsx'

wb.open(source_filename)
ws = wb.active
ws.cell('A1').value = 3.14
wb.save(destination_filename)
wb.close()

I face same issue with openpyxl 2.6.2

Logo images was added in template excel file but disappear in exported .xlsx file

I just install Pillow and now its exporting all images fine.

pip install Pillow

This is my sample code to create salary slip from template excel file:

from openpyxl import load_workbook


def create_salary_slip():
    wb = load_workbook(filename = 'salary.xlsx')
    # grab the active worksheet
    ws = wb.active
    # Add Income
    ws['D11'] = 25000
    # Add deduction
    ws['M11'] = 1500
    # Save the file
    wb.save("sample.xlsx")

create_salary_slip()