Locked lesson.
About this lesson
We'll cover how to add images to your spreadsheet.
Exercise files
Download this lesson’s related exercise files.
40 - Adding Images.docx57.4 KB 40 - Adding Images SOLUTION.docx
56.2 KB
Quick reference
Adding Images
In this video I'll show you how to add Images to your spreadsheet.
When to use
Use this whenever you want to add an image to your spreadsheet.
Instructions
# Install Pillow to the terminal
pip install Pillow
# Install Libraries
from openpyxl.drawing.image import Image
# create Image instance
img = Image("aspen.png")
# Set image height and width
img.height = 50
img.width = 50
# add image to worksheet
ws.add_image(img, 'D2')
Hints & tips
- pip install Pillow
- from openpyxl.drawing.image import Image
- img = Image("aspen.png")
- ws.add_image(img, 'D2')
- img.height = 50
- img.width = 50
Lesson notes are only available for subscribers.