if data:
print("Redirected")
cellNum = wks.acell(f'A{countt}')
# I want to color this cell (the cell number is stored in cellNum (<Cell R2C1>))
else:
print("Not")
I want to color the cell for which my condition is true.
I believe your goal is as follows.
In this case, how about the following modification?
if data:
print("Redirected")
cellNum = wks.acell(f"A{countt}")
wks.format(cellNum.address, {"backgroundColor": {"red": 1, "green": 0, "blue": 0}}) # <--- Added
else:
print("Not")
cellNum
is changed to red.{"red": 1, "green": 0, "blue": 0}
. Please be careful about this.