'How to copy only the image from one excel to another using python?
I have written a script in python to copy an image from one excel file to another and store it. I have successfully done it. But my issue is that the data from the excel file is also being copied. The end result I am trying to achieve is that: irrespective of data in excel-file1, the image in the file should be copied to excel-file2.
workbook = openpyxl.load_workbook('path to excel file1')
sheet = workbook['Sheet1']
img = openpyxl.drawing.image.Image('path to image')
img.width = 25 * 1
img.height = 25 * 1
sheet.add_image(img, 'A1')
workbook.save('path to excel file2')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
