Skip to content Skip to sidebar Skip to footer

Move To Adjacent Cells Using Openpyxl

I have an algorithm that finds a value in a cell, for this case lets say that cell is C10. I need to look next to that in column D for a value, and if that value doesnt match what

Solution 1:

bits = []
min_address = False
for row in ws.iter_rows(row_offset=4,column_offset=3):
    c = row[2]
    d = row[3]
    if not d.internal_value: #d will always have a value if the row isn't blank
        if min_address: 
            break #bits is what you want it to be now
        bits = [] #reset bits every time we hit a new row
        continue #this will just skip to next row

    for bits_cell in row[4:]:
        if bits_cell.internal_value:
            bits.append(bits_cell.internal_value)
    if c.internal_value:
        if c.internal_value == min(address):
            min_address = True #we set it to true, then kept going until blank row

Post a Comment for "Move To Adjacent Cells Using Openpyxl"