Skip to content

Used Range of worksheet #96

@DAYUCS

Description

@DAYUCS

In workbook.py, we calculate used_ranges by:

if include_ranges:
# Add used ranges for each sheet
ranges = {}
for sheet_name in wb.sheetnames:
ws = wb[sheet_name]
if ws.max_row > 0 and ws.max_column > 0:
ranges[sheet_name] = f"A1:{get_column_letter(ws.max_column)}{ws.max_row}"
info["used_ranges"] = ranges

However worksheet's max_column and max_row refer to the total capacity of an Excel sheet. May we change this to worksheet.calculate_dimension()?

https://openpyxl.readthedocs.io/en/stable/api/openpyxl.worksheet.worksheet.html#openpyxl.worksheet.worksheet.Worksheet.calculate_dimension

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions