The Scenario
The loyalty campaign launches Monday. 500 unique discount codes, each one assigned to a specific customer, all mapped to the same price rule. The marketing manager has the code strings in column A of a Google Sheet. She needs each code created in Shopify, with the confirmation ID written back so she can match codes to customers when she sends the emails.
The campaign launches in four days. Shopify's admin lets you create one discount code at a time.
The bad version:
- Open the Shopify discount code creator, enter the first code string, set the price rule, save.
- Go back to the code list, click New discount code, enter the second string, save.
- 500 times. With no undo if a typo slips through.
You could get someone to do this for two days. Or you could not.
The Easy Way: One Prompt in SheetXAI
SheetXAI is an AI agent that lives inside your Google Sheet. It reads the code list and creates each Shopify discount code via the API, batch by batch, writing the result back into the sheet as it goes.
Create Shopify discount codes for all values in column A of my Promo Codes sheet under the price rule ID in cell B1 — write 'created' or the error into column B for each row
What You Get
- A Shopify discount code created for each value in column A, all linked to the price rule in cell B1.
- Column B updated with "created" for each success, or the specific error message for any code that failed (e.g., a duplicate that already exists in Shopify).
- All 500 codes appear in your Shopify discount code list immediately and are usable in customer emails.
What If the Data Is Not Quite Ready
Some code strings are duplicates of existing codes in Shopify
Create Shopify discount codes for all values in column A of my Promo Codes sheet under price rule ID in cell B1 — skip any code that already exists in Shopify — write 'created' or 'duplicate' into column B
Codes need a usage limit of 1 per code, not the default
Create Shopify discount codes for all values in column A under price rule ID in cell B1 — set usage_limit to 1 for each code — write the discount code ID into column C and 'created' into column B
The code list spans two tabs — one for the first campaign wave, one for the second
Create Shopify discount codes for all rows in my Wave-1 Codes sheet (column A) and my Wave-2 Codes sheet (column A), all under price rule ID from the Config tab cell A2 — write the result into column B of whichever tab each row came from
Check for duplicates, set usage limit, create from both tabs, and write back code IDs
For each row in my Promo Codes sheet where column B is blank, create a Shopify discount code for the value in column A under price rule ID in cell B1 — skip duplicates, set usage_limit to 1 — write the discount code ID into column C and 'created' or 'duplicate' into column B
Combining the deduplication check and the creation in one prompt means you don't run a pre-check pass before you run the import pass.
Try It
Get the 7-day free trial of SheetXAI and open the campaign code sheet before the next loyalty push, then ask SheetXAI to create all the codes in one operation. When the next campaign arrives, you'll use the same pattern. Also worth reading: how to export price rules for a promotions audit, or the hub overview for all Shopify workflows.
