def set_border(ws, cell_range):
    rows = ws.range(cell_range)
for row in rows:
    row[0].style.borders.left.border_style = Border.BORDER_THIN
row[-1].style.borders.right.border_style = Border.BORDER_THIN
for c in rows[0]:
    c.style.borders.top.border_style = Border.BORDER_THIN
for c in rows[-1]:
    c.style.borders.bottom.border_style = Border.BORDER_THIN
ws = load_workbook('example.xlsx').get_active_sheet()
set_broder(ws, 'C3:H10')
Примените границы ко всем ячейкам в диапазоне с помощью openpyxl