Am .01.2016, 01:15 Uhr, schrieb Bill St. Louis <
wfs...@gmail.com>:
> My apologies for continuing to bug you with what are probably trivial
> questions I should know the answer to, but let me try one more time.
> When
> I put that code in, this is what pops up:
>
>>>> for cell in ws['A1':'M1']:
> cell.alignment = al
>
> Traceback (most recent call last):
> File "<pyshell#20>", line 2, in <module>
> cell.alignment = al
> AttributeError: 'tuple' object has no attribute 'alignment'
Sorry, my mistake. The range is always a collection of rows.
for row in ws['A1':'M1']:
for cell in row:
cell.alignment = al
> I can print the cell objects as it iterates through A1 thru M1 (looks
> like
> this: "<openpyxl.cell.read_only.ReadOnlyCell object at 0x1073c1a98>,
> <openpyxl.cell.read_only.ReadOnlyCell object at 0x1073c1af0>"), but when
> I
> try to access the attributes, it's not allowing it. I can't print any of
> the object attributes or change them.
If you're using read-only mode you won't be able to change anything.
Stands to reason.