Log daily Loop returns to Sheets and flag big refunds

Every morning at 6am, yesterday's Loop returns land in your spreadsheet, and any refund above your limit opens a support ticket for a human.

Deterministic Code
Loop ReturnsGoogle SheetsGorgiasOperationsCustomer SupportData SyncNotifications & Alerts
PromptCreate

Every morning at 6am, pull the previous 24 hours of returns from Loop Returns, append one row per return to a Google Sheets log, and open a Gorgias ticket for any return whose refund is above a threshold I set. Every step here is a fixed field mapping plus one threshold check, so build it as a deterministic code workflow rather than an agent.

Trigger: a cron schedule, once a day at 6am in my local timezone. Loop Returns is not available as a polling source on this platform, so cron plus a list call inside the workflow is the right shape.

Step one, fetch the returns. Call the Loop Returns Detailed Returns List operation with no from or to values, because that endpoint already defaults to the previous 24 hours, which lines up exactly with a daily 6am run. Pass paginate=true and a pageSize of 250 so a busy day is not truncated (the default page size is 100 and the max is 750), then keep following nextPageUrl until it comes back null. Loop allows 300 requests per minute per API key and returns a 429 when you exceed it, so pause briefly and retry rather than failing the run.

Step two, normalize each return into a row. Loop reports money as a MoneySet, an integer amount in minor units plus a currency code, so divide the refund amount by 100 before writing it and keep the currency code in its own column. Collapse the line items into a single readable cell, for example: 2 x Merino Crew Sweater, 1 x Wool Socks. Where a return has different reasons across its items, join the distinct reasons with a comma. The columns, in order, are: Return ID, Order Name, Customer Email, Items, Return Reason, Refund Amount, Currency, Status.

Step three, write the rows. Use the Google Sheets Append Values operation to append the whole day's rows in a single call to the returns log tab, below the existing header row rather than overwriting it. Use valueInputOption USER_ENTERED so refund amounts land as numbers rather than text. If there were no returns in the window, write nothing and finish cleanly.

Step four, flag the high-value refunds. Define the threshold as an editable constant at the top of the workflow, expressed in major units (default it to 200), not buried inside a node, so I can change it without touching the logic. For every return whose converted refund amount is at or above that threshold, call the Gorgias Create Ticket operation. Use a subject in the form: High-value return: {order name} ({refund amount} {currency}). The body should restate the return id, order name, customer email, items, return reason, refund amount and currency, and the current return status, then close with a line asking the assigned agent to reach out to the shopper personally before the refund lands. Create the ticket with an internal note message so nothing is emailed to the shopper automatically, and set the ticket customer to the shopper's email so it threads onto their existing Gorgias record.

Gorgias rate limits API key integrations to 40 requests per 20 second window and sends back a Retry-After header when you cross it, so space out ticket creation on a heavy day instead of firing them all at once.

Keep the Loop return id in the first column so that if I ever re-run the workflow by hand, duplicate rows are obvious and easy to clean up.

Example output

Google Sheets row appended: RET-48213 | #1094 | dana.reeves@example.com | 2 x Merino Crew Sweater, 1 x Wool Socks | Too small | 248.00 | USD | open Gorgias ticket created (internal note): High-value return: #1094 (248.00 USD) Return RET-48213 for dana.reeves@example.com. Items: 2 x Merino Crew Sweater, 1 x Wool Socks. Reason: Too small. Refund: 248.00 USD. Status: open. Please reach out to this shopper personally before the refund is issued.

What does this prompt do?

  • Runs every morning at 6am and collects every return your shoppers created in the last 24 hours.
  • Adds one row per return to your Google Sheets log, covering the return, the order, the shopper's email, the items coming back, the reason, the refund amount and currency, and where the return stands right now.
  • Opens a Gorgias ticket for any refund above the amount you set, so someone reaches out personally before the money goes back.
  • Works through the whole day's returns rather than stopping at the first batch, so a busy Monday is captured in full.

What do I need to use this?

  • A Loop Returns account you can connect, with permission to read your returns.
  • A Google account and a spreadsheet with a tab for the log and a header row across the top.
  • A Gorgias helpdesk your support team already works out of.
  • A refund amount you consider high value, so the workflow knows when a person should step in.

How can I customize it?

  • Change the run time, or run it twice a day during peak returns season.
  • Raise or lower the high-value refund amount as your average order value changes. It is a single setting at the top of the workflow.
  • Adjust the columns in the log, or point the workflow at a different tab or spreadsheet.
  • Reword the support ticket, or add tags so high-value returns are easy to filter in Gorgias.

FAQs

Does this email my customer when a high-value return comes in?
No. The Gorgias ticket is created as an internal note for your support team. Nothing goes to the shopper until one of your agents decides to reply.
What happens on a really busy returns day?
The workflow works through the full list of returns rather than stopping at the first batch, so every return from the last 24 hours makes it into the sheet.
Can I change what counts as a high-value refund?
Yes. The threshold is a single editable setting at the top of the workflow, so you can change it in seconds without rebuilding anything.
Does it handle more than one currency?
Yes. The refund amount and the currency code go into separate columns, so you can filter or convert later. The high-value check compares against one amount, so set it in the currency most of your orders use.
Do I need my store connected as well as Loop?
No. Everything in the log comes from Loop Returns, including the order name and the shopper's email, so Loop and your helpdesk are all you need.
What if there were no returns yesterday?
Nothing is written to the sheet and no tickets are created. The workflow simply finishes.

Related templates

Weekly Amazon S3 bucket security audit posted to Slack

Every Monday, check every S3 bucket for public exposure, missing encryption and weak backup settings, then get the risks ranked in Slack.

Amazon S3
Slack Bot
Google Sheets
Agentic Task
Turn procurement portal tenders into CRM deals each morning

Every weekday at 7am, sign in to the tender portals you track, filter new notices against your bid criteria, and open a deal for the ones worth chasing.

Anchor Browser
Google Sheets
HubSpot
+1
Agentic Task
Draft polite follow-ups for emails that never got a reply

Every weekday at 4pm, spot the threads that went quiet, stage a ready-to-send nudge in your mailbox, and get a ranked Slack recap.

Aurinko
Google Sheets
Slack Bot
Agentic Task
Flag VIP client emails in Zoho Mail and alert your team

Keep a spreadsheet of your most important senders, and every email from one gets labeled, posted to your team channel, and logged automatically.

Zoho Mail
Google Sheets
Slack Bot
Deterministic Code
Send Yotpo review requests when Shopify orders ship

The moment an order is fulfilled, we register it with Yotpo so the review request is timed off real delivery, and we log every sync so failures never go unnoticed.

Shopify
Yotpo
Google Sheets
Deterministic Code
Reconcile Shopify sales against Zoho Books every night

Every night at 11pm we compare the day's Shopify orders with your Zoho Books invoices and payments, and flag only what does not match.

Zoho Books
Shopify
Google Sheets
+1
Agentic Task

Stop copying returns into a spreadsheet by hand.

Get a returns log that fills itself every morning, and a support ticket the moment a big refund needs a human.