Paste the image in the range of A1 to G10.
import openpyxl
workbook = openpyxl.load_workbook(insert.xlsx)
sheet = workbook['Sheet1']
img = openpyxl.drawing.image.Image(img.png)
img.width = 72 * 7
img.height = 25 * 10
sheet.add_image(img, 'A1')
workbook.save(insert.xlsx)
Paste the image in the range of K3 to T15.
workbook = openpyxl.load_workbook(insert.xlsx)
sheet = workbook['Sheet1']
img = openpyxl.drawing.image.Image(img.png)
img.width = 72 * 10
img.height = 25 * 13
sheet.add_image(img, 'K3')
workbook.save(insert.xlsx)
Paste the image in the range of C13 to D21.
workbook = openpyxl.load_workbook(insert.xlsx)
sheet = workbook['Sheet1']
img = openpyxl.drawing.image.Image(img.png)
img.width = 72 * 2
img.height = 25 * 9
sheet.add_image(img, 'K3')
workbook.save(insert.xlsx)
https://allabout.co.jp/gm/gc/297706/ https://qiita.com/HirotakaKikushima/items/a42e3e94273247199b9a
Recommended Posts