import openpyxl
def factuur():
wb = openpyxl.load_workbook(\'factuurvoorbeeld1.xlsx\')
Blad1 = wb.active
Blad1[\'K7\'] = \'logo.png\'
Blad1[\'E22\']
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()