The Scenario
The dev team is two days away from wiring up loyalty earn triggers on a new Shopify integration. Before any triggers can fire, every product needs to exist in Piggy with the correct external identifier. The ecommerce operations manager has 150 product SKUs in a Google Sheet — columns for external_id and product_name — and needs to confirm every one of them is in Piggy before the engineers start the integration work.
The bad version:
- Go into Piggy, find the product management section, search for SKU one, check if it exists, create it if it doesn't, note the Piggy product ID.
- Repeat 149 more times. Some SKUs are already there from a previous import. Some aren't. There's no easy way to tell from the sheet alone which is which.
- Two hours later, you have a mix of product IDs and gaps, and the dev team is asking if it's ready.
The integration timeline doesn't flex. The products need to be ready before the engineers start. Doing this one by one is how blockers get created.
The Easy Way: One Prompt in SheetXAI
SheetXAI is an AI agent that lives inside your Google Sheet. It reads the product list, calls Piggy's find-or-create endpoint for each one, and writes the returned Piggy product ID back into the sheet — so you end up with a complete reference map in one pass.
For each product in the 'Products' sheet (columns: external_id, product_name), call Piggy's find-or-create product endpoint and write the Piggy product ID into column C
What You Get
- Column C fills with the Piggy product ID for each product — whether the product already existed or was just created.
- Rows where Piggy created a new product can be distinguished from existing ones if Piggy returns a created flag — SheetXAI writes that into column D.
- Rows where the operation failed (missing name, invalid external_id format, API error) get a descriptive note so you can fix and retry those specific rows.
- All 150 products are processed in one pass, giving the dev team a complete external_id to Piggy ID reference map.
What If the Data Is Not Quite Ready
Some external IDs have inconsistent formatting — mixed case, extra dashes
For each row in the 'Products' sheet, normalize the external_id in column A to lowercase with hyphens replacing underscores, then call Piggy's find-or-create product endpoint. Write the normalized external_id into column D and the returned Piggy product ID into column C
You need to know which products were new versus already existing
For each product in the 'Products' sheet, call Piggy's find-or-create product endpoint. Write the Piggy product ID into column C. Write CREATED into column D if the product was new, or EXISTING into column D if it was already in Piggy. Write the total new and existing counts into cells F1 and F2
Some rows have a category in column C that needs to be passed to Piggy on creation
For each row in the 'Products' sheet (columns: external_id, product_name, category), call Piggy's find-or-create product endpoint. Include the category field on creation. Write the returned Piggy product ID into column D and the status into column E
Normalize, find-or-create, validate the result, and build the full reference map
For each of the 150 products in the 'Products' sheet, normalize the external_id to lowercase. Call Piggy's find-or-create endpoint with the external_id and product_name. Write the Piggy product ID into column C, whether it was created or pre-existing into column D, and any errors into column E. After all rows are processed, write a summary into cells G1 through G3: total processed, total created, total errors
Combining the normalization, the sync, and the summary in one prompt means you hand the dev team a reference sheet they can actually use rather than a partial list with gaps to fill.
Try It
Open a Google Sheet with your product SKU list and Get the 7-day free trial of SheetXAI. Ask it to find or create every product in Piggy and write the IDs back so your earn rules are ready to wire up. For related workflows, see how to export the Piggy perks catalog or the full Piggy integration overview.
