How to assign calc 2d named range to python variable - solved

I can’t seem to find a simple answer to the question. I have this successfully working in Basic:

NamedRange = ThisComponent.NamedRanges.getByName("transactions_detail")
RefCells = NamedRange.getReferredCells()
Set MainRange = RefCells.getDataArray()

Then I iterate over MainRange and pull out the rows I am interested in.

Can I do something similar in a python macro? Can I assign a 2d named range to a python variable or do I have to iterate over the range to assign the individual cells?

I am new to python but hope to convert my iteration intensive macro function to python in hopes of making it faster.

Any help would be much appreciated.

Thanks.

(Slightly edited for better readability by @Lupp )

do

     doc = XSCRIPTCONTEXT.getDcument()
     NamedRange = doc.NamedRanges["transactions_detail"]
     RefCells = NamedRange.getReferredCells()

     Data = RefCells.getDataArray()
     #calc cast **DataArray** to  nestet tuple of Rows
     #with inner tuple's of Columns for each Row.
     for row in Data:
         …

thanks karolus

Please, if the answer solves the question click :heavy_check_mark:.