I am trying to compare two sheets from my excel and list the row that is not matching from sheet1 using xlrd in python.
Sheet1:
Name Gender Age
John M 30
Moses F 28
Sheet2:
Name Gender Age
John M 30
Moses F 29
import xlrd as xl
loc = "C:/Users/S22JK3/Desktop/Sample.xlsx"
wb = xl.open_workbook(loc)
sheet1 = wb.sheet_by_index(0)
sheet2 = wb.sheet_by_index(1)
row1 = sheet1.nrows
column1 = sheet1.ncols
row2 = sheet2.nrows
column2 = sheet2.ncols
row = max(row1,row2)
column = max(column1,column2)
for i in range(row):
for j in range(column):
if sheet1.cell(i,j) != sheet2.cell(i,j):
print(sheet1.cell(i,j))
When i try to run the above code, I am getting error as "Expected an indented block"