Group & Ungroup Excel Rows/Columns in Python
Apply grouping and ungrouping of rows and columns in Excel using intuitive IronXL for Python APIs, without requiring Office Interop.
Group and Ungroup Rows
The GroupRows method groups rows by specifying their index positions. Multiple groupings can be applied using repeated calls to this method.
To ungroup rows, use the UngroupRows method. This method acts like a cutting tool—when applied to the middle of an existing row group, it splits that group into two. For example, ungrouping rows 2–4 within a group spanning 0–9 results in groups 0–1 and 5–9.
Group and Ungroup Columns
Columns can be grouped in the same way as rows. Use the GroupColumns method to group columns by their index positions or by specifying column names as strings. Multiple column groups can be created as needed.
To ungroup columns, use the UngroupColumns method, which also functions as a cutting tool. Applying it in the middle of a column group splits it in two. For instance, ungrouping columns C–D within a group A–F results in groups A–B and E–F.
All index positions use zero-based indexing. Grouping can only be applied as far as the cells contain values.
Learn to Group and Ungroup Excel Rows and Columns with IronXL for Python






