I have 2 xlsx files and need to print the differences in each cell in the file. The code that I am using now is working but I need to ignore the first column in each of the xlsx files and I am not sure how to add that exception to the code I am currently using.
ds1 = xlrd.open_workbook("PATH1")
ds2 = xlrd.open_workbook("PATH2")
SHEET1 = ds1.sheet_by_index(0)
SHEET1 = ds2.sheet_by_index(0)
for rownum in range(max(POB_ds1.nrows, POB_ds2.nrows)):
if rownum < SHEET1_ds1.nrows:
row_rb1 = SHEET1_ds1.row_values(rownum)
row_rb2 = SHEET1_ds2.row_values(rownum)
for colnum, (c1, c2) in enumerate(zip_longest(row_rb1, row_rb2)):
if c1 != c2:
print ("Row {} Col {} - {} != {}".format(rownum+1, colnum+1, c1, c2))
else:
print ("Row {} missing".format(rownum+1))
How about this approach?
See the link below for all details.
https://pbpython.com/excel-diff-pandas.html