Copy/paste all rows found in "Find All" Keyword Search - Libreoffice Calc

I have a large spreadsheet file which I am searching for certain keywords. So I do “Find All”.

I get e.g. 100 hits. I want to copy all the rows containing the keyword and paste into another sheet.

How do I select and then copy/paste those rows?


In the case the hits are all in the same column you can do the task by:
`> Data > Filter > Standardfilter (…)

  • Options:
    [x]regular Expression
    [x]Filteroutput to: “other Sheet.…”`


If your hits spread widely over several columns, you can try your search up to find all and run then:

from uno import createUnoStruct as create_struct

def copyrows():
    source_address = create_struct("")
    target_address = create_struct("")
    doc = XSCRIPTCONTEXT.getDocument()
    sheet = doc.CurrentController.ActiveSheet
    descriptions = doc.CurrentSelection.RowDescriptions
    rows = { entry.split()[1] for entry in descriptions }
    rows = sorted(map(int,rows))

    for i, row in enumerate(rows):        
        source_address.StartRow = source_address.EndRow = row-1
        source_address.EndColumn = 1023
        target_address.Sheet = 1
        target_address.Row = i
        sheet.copyRange(target_address, source_address)    

its python, you have to copy this SourceCode into:

Keep care to have an empty sheet behind the sheet youre working on.

OK thanks, I’ll have to check this out. So if I search for my keyword in one column only, which I can do, I can then follow your steps? I’ll report back. Cheers