With openpyxl version 2.2.5, this snippet works for me:
from openpyxl.styles.borders import Border, Side
from openpyxl import Workbook
thin_border = Border(left=Side(style="thin"),
right=Side(style="thin"),
top=Side(style="thin"),
bottom=Side(style="thin"))
wb = Workbook()
ws = wb.get_active_sheet()
# property cell.border should be used instead of cell.style.border
ws.cell(row=3, column=2).border = thin_border
wb.save('border_test.xlsx')
The documentation mentions other values for the style attribute :
Value must be one of {‘double’, ‘dashed’, ‘thin’, ‘medium’,
‘mediumDashDot’, ‘dashDot’, ‘thick’, ‘mediumDashed’, ‘hair’, ‘dotted’,
‘slantDashDot’, ‘mediumDashDotDot’, ‘dashDotDot’}