Skip to content

Instantly share code, notes, and snippets.

@atsmith813
Last active November 6, 2019 18:00
Show Gist options
  • Save atsmith813/891afab9d421c9427aaf8e3bfcbd765c to your computer and use it in GitHub Desktop.
Save atsmith813/891afab9d421c9427aaf8e3bfcbd765c to your computer and use it in GitHub Desktop.
Update today's birthdays to be 1 year in the future
# Continuing with the birthdays, todays_birthdays, session, spreadsheet, and ws objects created above...
(1..ws.num_rows).each do |row|
name = ws[row, 1]
birthday = todays_birthdays.find { |bday| bday[:name] == name }
next unless birthday
next_birthday = birthday[:date].next_year.to_s
ws[row, 2] = next_birthday
puts "Set #{name}'s birthday to #{next_birthday}"
end
ws.save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment