Cell and ranges ~~~~~~~~~~~~~~~ Cells ^^^^^ * By name .. code-block:: python sheet = app.active_sheet cell = sheet['A1'] app.msgbox(cell.name) * By position [row, column] .. code-block:: python cell = sheet[1, 4] app.msgbox(cell.name) Ranges ^^^^^^ * By name .. code-block:: python sheet = app.active_sheet rango = sheet['B2:D5'] app.msgbox(rango.name) * By position [start_row:end_row, start_column:end_column] .. code-block:: python rango = sheet[1:5,1:4] app.msgbox(rango.name) * Group ranges .. code-block:: python doc = app.active sheet = doc.active last = doc[-1] with doc.ranges as r: # Add one range r.add(sheet['A1:B2']) r2 = sheet['C4:D5'] r3 = last['E7:D8'] r4 = last['E10:F12'] # Add multiple ranges r.add((r2, r3, r4)) app.debug(r.names) * Get the same range in all sheets .. code-block:: python ranges = doc.get_ranges('A1:B1') app.debug(ranges.names) * Get columns by name. .. code-block:: python sheet = app.active_sheet rango = sheet['B:B'] app.debug(rango.name) rango = sheet['D:F'] app.debug(rango.name) * Get columns by position. .. code-block:: python sheet = app.active_sheet # Column B rango = sheet[0:,1] app.debug(rango.name) # Columnas D:F rango = sheet[0:,3:6] app.debug(rango.name) * Get rows .. code-block:: python sheet = app.active_sheet # One row row = sheet[1] app.debug(row.name) # Range rows row = sheet[3:10,0:] app.debug(row.name) Info ranges ^^^^^^^^^^^ * Get absolute name .. code-block:: python sheet = app.active_sheet rango = sheet['A1:E10'] app.msgbox(rango.name) * Get address .. code-block:: python sheet = app.active_sheet rango = sheet['A1'] a = rango.address data = f"""Cell Address Row: {a.Row} Column: {a.Column} """ app.msgbox(data) rango = sheet['A1:E10'] ra = rango.range_address data = ( f'Range Address:\n\n' f'Star Row: {ra.StartRow}\n' f'End Row: {ra.EndRow}\n' f'Star Column: {ra.StartColumn}\n' f'End Column: {ra.EndColumn}\n' ) app.msgbox(data) Special ranges ^^^^^^^^^^^^^^ * Get used area .. code-block:: python sheet = app.active_sheet rango = sheet.used_area app.msgbox(rango.name) * Get current region .. code-block:: python rango = sheet['A1'].current_region app.msgbox(rango.name) * Get next free cell .. code-block:: python cell = sheet['A1'].next_cell app.msgbox(cell.name) * Get merged area .. code-block:: python sheet = app.active_sheet rango = sheet['A1'].merged_area app.msgbox(rango.name) * Get visible cells .. code-block:: python sheet = app.active_sheet rangos = sheet['A1:E10'].visible for r in rangos: app.debug(r.name) * Get empty cells .. code-block:: python sheet = app.active_sheet rangos = sheet['A1:E10'].empty for r in rangos: app.debug(r.name)