#importing openpyxl module import openpyxl # workbook object is created workbook1 = openpyxl.load_workbook("edges.coordinates.xlsx") workbook2 = openpyxl.load_workbook("s data.xlsx") #For sheet1 sheet_obj1 = workbook1["sheet1"] #For sheet2 sheet_obj2 = workbook1["sheet2"] #for s workbook sheet_obj3 = workbook2["sheet1"] # Will print a particular row value for j in range(0, sheet_obj3.max_row): #Fetching Data From Cell For Sheet1/workbook 2 x= sheet_obj3.cell(row = 1+j, column = 1).value y = sheet_obj3.cell(row = 1+j, column = 2).value z = sheet_obj3.cell(row = 1+j, column = 3).value # Will print a particular row value for i in range(1, sheet_obj1.max_row): #Fetching Data From Cell For Sheet1 x1 = sheet_obj1.cell(row = i, column = 1) y1 = sheet_obj1.cell(row = i, column = 2) x2 = sheet_obj1.cell(row = i+1, column = 1) y2 = sheet_obj1.cell(row = i+1, column = 2) z1 = sheet_obj1.cell(row = i, column = 3) #Fetching Data From Cell For Sheet2 x11 = sheet_obj2.cell(row = i, column = 1) y11 = sheet_obj2.cell(row = i, column = 2) x22 = sheet_obj2.cell(row = i+1, column = 1) y22 = sheet_obj2.cell(row = i+1, column = 2) #Printing Warning If Condition Is Satisfied if z == z1.value: if min(x1.value,x2.value,x11.value,x22.value)<=x <=max(x1.value,x2.value,x11.value,x22.value) and min(y1.value,y2.value,y11.value,y22.value)<=y<=max(y1.value,y2.value,y11.value,y22.value): print("Warning Between Row"+str(i)+" and Row"+str((i+1))) i