Let’s say you want to send someone a coupon code when they sign up for your mailing list. You’ve generated a list of coupon codes, downloaded a CSV...but now what? How do you find out if a coupon code has been sent out before? And how do we send a brand new one every time?
Well, with a couple of Google Sheets steps, we can both get the first unused code, and mark it as used so it never comes up again!
The first thing to do is to get those coupon codes into a Google Sheet, and make sure it’s set up properly. We only need two columns: Coupon, and Used. Coupon will track the coupon code, and then Used will track whether or not it has been used before. Make sure to put “no” into the Used column, so it looks like this:
Now that your Sheet is set up, let’s take a look at an outline for the Zap that will use these:
Step 1 Trigger: Anything you like. Maybe someone signs up for a list, or they write into a contact form - it’s up to you!
Step 2 Action: Lookup Spreadsheet Row in Google Sheets. Search for “no” in the Used column, and this will pull up the very first result. It should look like this:
Step 3 Action: Send Coupon Code to customer - you can use whatever system you like here as well. Just use the coupon code from the previous step.
Step 4 Action: Update Spreadsheet Row in Google Sheets. Using the Row ID from Step 2, change the “Used” column to “yes.” This will ensure that this coupon code is never used again. Here’s what that looks like:
So, every time this Zap runs, it will (a) get the first unused coupon code, then (b) mark that coupon code as used. It would look like this after running 3 times:
That way, the next time this runs, it will pull the coupon from Row 5, skipping the first three! You can also use the “Update Spreadsheet Row” step to insert other information if you like, including who you sent it to, their name, the date it was issued, etc. Just add more columns to your sheet, and fill it in with information from your trigger.
And you’re all set! Hopefully this helps. :)