Openpyxl find cell or row by value

Is there a method that knows where I can find a cell or row in a document if I have a value other than iterating over the entire document to find it? The thing is, I have very large common sheets that I need to compare, and I do this using the only UUID that exists in every record on every sheet.

So basically:

ws1 = rows1
ws2 = rows2  
for row1 in rows1:
    uuid = row1[0].value
    comp = row1[1].value
        for row2 in rows2:
            if row2[0] = uuid
                if row2[0] = comp
                    do-stuff()

      

This seems more nested than it should be. Is there a way to find the value in rows2 easier than this?

+3


source to share


1 answer


No, there is no other way to search content than to navigate a cell by cell.



+4


source







All Articles