Skip to content

Instantly share code, notes, and snippets.

@Abhayparashar31
Created October 6, 2020 02:52
Show Gist options
  • Save Abhayparashar31/614a201347a0ef7cdfde045aad24977a to your computer and use it in GitHub Desktop.
Save Abhayparashar31/614a201347a0ef7cdfde045aad24977a to your computer and use it in GitHub Desktop.
for index, item in df.iterrows():
#print(index,item['birthday'])
bday = item['Birthday'].strftime("%d-%m") ##wishing time from excel file
#print(type(bday))
if(bday == today) and yearnow not in str(item["Year"]): ## birthday data == today date and birthday year is not equal to current year
sendEmail(item['Email'] ,"Happy BIrthday "+item["Name"], item['message']) ## pass arguments to the send email funciton and call it
update.append(index) ## update the index by one ## we need to check the whole records
for i in update:
yr = df.loc[i, 'Year'] ## update the year by one
#print(yr)
df.loc[i,'Year'] = f"{yr}, {yearnow}"
#print((df.loc[i, 'Year'])
#print(df)
df.to_excel("data.xlsx", index=False) ## convert the df to excel file and save it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment