Efficient way of adding borders with openpyxl
I want to add borders in a range with openpyxl. All I've found online is that you need to add borders cell per cell, like this for example. import openpyxl, time from openpyxl.styles.borders import Border, Side startTime = time.time() wb = openpyxl.Workbook() ws = wb.active border = Side(border_style = 'dashed', color = '000000') border = Border(left = border, right = border, bottom = border, top = border) wsRange = 'A1:AZ2500' for rows in ws[wsRange]: for cell in rows: cell.border = border print(time.time() - startTime) However, the larger the range the longer it takes. In this example with a
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.