Insert blank row below colored cell

Hello. I have a spreadsheet with 7,000 rows, and I need to add many rows to be able to add some data. If I have to go through them one by one, it will take a long time.

I used the search and replace option for a specific string of characters within the cells in column A and colored those cells with a specific background color.

  1. Is it possible to insert an empty row or n empty rows below those colored cells?
  2. If it is possible to insert those empty rows below those cells with that specific color, and there are cells in the column with multiple background colors, how could I distinguish and insert those rows below the color I want, instead of having the rows inserted in a different color?

My Libreoffice version is v7.2.7.2 on Windows 10

repeat this specific S&R with Find All
run this Python-snippet ( or translate it to Basic ):

def insert_k_rows_below_selections(*_):
    k = 5  ## adapt the number to your needs
    doc = XSCRIPTCONTEXT.getDocument()
    selections = doc.CurrentSelection
    rows = doc.CurrentController.ActiveSheet.Rows
    for sel in selections:
        rows.insertByIndex(sel.RangeAddress.StartRow+1, k)

Ctrl++

2025-08-25 16 00 19

Version: 25.2.4.3 (x86) / LibreOffice Community
Build ID: 33e196637044ead23f5c3226cde09b47731f7e27
CPU threads: 8; OS: Windows 11 X86_64 (10.0 build 26100); UI render: Skia/Vulkan; VCL: win
Locale: en-CA (de_DE); UI: en-US
Calc: threaded