I am hoping someone can help me as I have been unable to figure this one out for myself unfortunately.
I am trying to put a thin border around a cell using openpyxl 2.3.3 and python 3.4. I have the following code:
from openpyxl.styles import Border
ws.cell('A1').border = Border(top = Side(border_style='thin', color='FF000000'),
right = Side(border_style='thin', color='FF000000'),
bottom = Side(border_style='thin', color='FF000000'),
left = Side(border_style='thin', color='FF000000'))
Oddly this is throwing the following error:
NameError: name 'Side' is not defined
I have looked at the official documentation here:
http://openpyxl.readthedocs.org/en/2.4/styles.html http://openpyxl.readthedocs.org/en/2.4/_modules/openpyxl/styles/borders.html
I have also looked at the following articles with no luck:
https://bitbucket.org/openpyxl/openpyxl/issues/365/styling-merged-cells-isnt-working
Applying borders to a cell in OpenPyxl
Apply borders to all cells in a range with openpyxl
Apply Border To Range Of Cells Using Openpyxl
Is anyone able to help me out?
Thanks in advance,
Eamon
You haven't imported the Side
object.
from openpyxl.styles import Border, Side
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With