I have two workbooks and Im looking to grab both of their column A to compare the cell values to see if there is a discrepancy.
If the column A (in workbook1) != column A(in workbooks2) delete the value in workbook1.
Heres what I have so far
book1_list = []
book2_list = []
tempList = []
column_name = 'Numbers'
skip_Head_of_anotherSheet = anotherSheet[2: anotherSheet.max_row]
skip_Head_of_other = sheets[2: sheets.max_row]
for val1 in skip_Head_of_other:
book1_list.append(val1[0].value)
for val2 in skip_Head_of_anotherSheet:
book2_list.append(val2[0].value)
for i in book1_list:
for j in book2_list:
if i == j:
tempList.append(j)
print(j)
Here is where I get stuck -
for temp in tempList:
for pointValue in skip_Head_of_anotherSheet:
if temp != pointValue[0].value:
anotherSheet.cell(column=4, row =pointValue[1].row, value ="YES")
# else:
#if temp != pointValue[0].value:
#anotherSheet.cell(column=4, row =pointValue[1].row, value ="YES")
# anotherSheet.delete_rows(pointValue[0])
#anotherSheet.delete_rows(row[0].row,1)
I also attempted to include to find the column by name:
for col in script.iter_cols():
# see if the value of the first cell matches
if col[0].value == column_value:
# this is the column we want, this col is an iterable of cells:
for cell in col:
# do something with the cell in this column here