Skip to content

openpyxl: Workbook opened in readonly mode should return ReadOnlyCell | EmptyCell from worksheet.rows #9940

Open
@jamesbeith

Description

@jamesbeith

Currently the type hints for worksheet.rows returns Cell objects. However, opening a workbook in readonly mode results in ReadOnlyCell or EmptyCell objects being returned.

>>> workbook = openpyxl_excel_reader.load_workbook(file, read_only=True)
>>> worksheet = workbook.worksheets[0]  # openpyxl.worksheet._read_only.ReadOnlyWorksheet
>>> [row for row in worksheet.rows]
[
    (<ReadOnlyCell 'Sheet1'.A1>, <EmptyCell>, <ReadOnlyCell 'Sheet1'.C1>),
    (<ReadOnlyCell 'Sheet1'.A2>, <EmptyCell>, <ReadOnlyCell 'Sheet1'.C2>),
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    stubs: improvementImprove/refactor existing annotations, other stubs issues

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions