Images dissapear in excel documents when copying them with python

后端 未结 3 1971
南方客
南方客 2021-01-13 11:26
import openpyxl

def factuur():
    wb = openpyxl.load_workbook(\'factuurvoorbeeld1.xlsx\')
    Blad1 = wb.active
    Blad1[\'K7\'] = \'logo.png\'
    Blad1[\'E22\']         


        
3条回答
  •  我在风中等你
    2021-01-13 11:57

    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()
    

提交回复
热议问题