Как получить (определить) последнюю заполненную ячейку в excel в виде переменой?

Информация интересует с 3 ячеек в B C D. Может быть так что например в ячейке B пусто, а в D есть информация

from PIL import Image
from io import BytesIO
import requests
import openpyxl
from openpyxl import Workbook


def get_img(url, size=(100, 100)):
    r = requests.get(url, stream=True)
    if not r.ok:
        r.raise_for_error()
    r.raw.decode_content = True
    img = Image.open(r.raw)
    if size:
        img = img.resize(size)
    temp = BytesIO()
    img.save(temp, format="png")
    temp.seek(0)
    return Image.open(temp)


def insert_row(ws, img_url, name, num, size=(200,200)):
    img = openpyxl.drawing.image.Image(get_img(img_url, size=size))
    row_num = ws.max_row + 1
    cell_addr = f"A{row_num}"
    img.anchor = cell_addr
    ws.add_image(img)
    ws[f"B{row_num}"] = name
    ws[f"C{row_num}"] = num
    ws.row_dimensions[row_num].height = int(size[1] * .8)
    ws.column_dimensions["A"].width = int(size[0] * .2)

##############################################################################

im_url_nastya = "https://s2.cdn.teleprogramma.pro/wp-content/uploads/2019/02/59d2d0c81e222b6a2dd496f448f454dd.jpg"
im_url_andrey = "https://ashevchenko.kiev.ua/assets/images/a-shevchenko-2.jpg"
im_url_yulya = "http://stuki-druki.com/aforizms/Yulia-Tymoshenko-01.jpg"

size = (200, 200)
wb = Workbook()
ws = wb.active

insert_row(ws, im_url_nastya, "Настя", 1, size=size)
insert_row(ws, im_url_andrey, "Андрей", 2, size=size)
insert_row(ws, im_url_yulya, "Юля", 3, size=size)

wb.save('c:/test.xlsx')

Ответы (0 шт):