Cell styling attributes are not showing up when invoked for a sheet made through create_sheet method

83 views
Skip to first unread message

Sreejith Rangarajan

unread,
Mar 14, 2025, 7:38:20 AMMar 14
to openpyxl-users
Hi All, Charlie,

I've been using openpyxl for sometime and have noticed the below issue with Style attributes of a cell when the cell is accessed via a worksheet that was created using the create_sheet method of the workbook.

I don't see this issue if the worksheet is grabbed using the active property of the workbook.

See the below images for an illustration of this via PyCharm

Here the auto completion works and shows all the available attributes inherited by the Cell class from its parent StyleableObjects class
Picture-1 Working.png

Here the same is not working
Picture-2 Problem.png

Do you think this is something we need to look into?

I'm using Python 3.12.1 and Openpyxl 3.1.5
Please let me know if more info is needed to understand this.

Regards,
Sreejith

Charlie Clark

unread,
Mar 14, 2025, 10:46:27 AMMar 14
to openpyxl-users
On 14 Mar 2025, at 12:38, Sreejith Rangarajan wrote:

> See the below images for an illustration of this via PyCharm
>
> Here the auto completion works and shows all the available attributes
> inherited by the Cell class from its parent StyleableObjects class

Whatever the issue is, I think it's related to the ability of lack of, the IDE, to introspect the objects.

I think this was one of the ideas behind type hints which, apart from the truly awful "line noise" implementation, have metastatised into an attempt into try and turn Python into a statically typed language.

Charlie

--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Sengelsweg 34
Düsseldorf
D- 40489
Tel: +49-203-3925-0390
Mobile: +49-178-782-6226

Sreejith Rangarajan

unread,
Mar 15, 2025, 3:13:13 AMMar 15
to openpyx...@googlegroups.com
Is there something we can do to make this work?

--
You received this message because you are subscribed to the Google Groups "openpyxl-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openpyxl-user...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/openpyxl-users/90656748-2018-4FC8-9D12-C779A78B5BB4%40clark-consulting.eu.

Charlie Clark

unread,
Mar 17, 2025, 5:16:51 AMMar 17
to openpyx...@googlegroups.com
On 15 Mar 2025, at 8:12, Sreejith Rangarajan wrote:

> Is there something we can do to make this work?

I think you need to talk to the PyCharm people as I don't think this is an issue with Openpyxl.

Sreejith Rangarajan

unread,
Mar 18, 2025, 12:25:21 PMMar 18
to openpyxl-users
Hi Charlie,

To be frank I don't think this is an IDE issue.
Here is the same issue being reproduced with clean install of VS Code.

Do we say that VS Code is also broken which uses pylance for this?

Working with wb.active:

Screenshot 2025-03-18 215037.png

Not working with create_sheet

Screenshot 2025-03-18 215116.png

Regards,
Sreejith
Reply all
Reply to author
Forward
0 new messages