I'm trying to make my program do a specific task when the content of the first row in my Excel file (which contains dates such as 2016-01-20) matches tomorrow's date, assigned to variable "d".
Here is an excerpt of the code:
reader = openpyxl.load_workbook(sys.argv[1])
sheet = reader.active
for row in range(4, sheet.max_row + 1):
i = date.today()
print i
d = date.today() + timedelta(days=1)
if row[0] == d:
sms_count = 0
total_sms_count = 0
#do some task
However, I'm getting the error:
Traceback (most recent call last):
File "SMS_Sender.py", line 49, in <module>
if row[0] == d:
TypeError: 'int' object has no attribute '__getitem__'
Geralds-MacBook-Pro:demos geraldkwok$
Can anyone tell me why I can't match the dates in my Excel file column to the variable "d" - and what I can do to fix it?
Thank you.