Global Finalist2026 Amazon Ads Partner Awards

Developer API · Prompt library · 06 of 10

Google Sheet that refreshes itself

Campaign, target and search-term performance landing in a Google Sheet every morning, with no exports.

Key scope
RRead-only key
Build time
30 minutes
Stack
Google Apps Script with a time-driven trigger

For: Teams that live in spreadsheets.

Paste this into Claude, ChatGPT or Cursor

Read https://www.sellermate.ai/api-docs first. It documents the SellerMate Public API: REST over HTTPS, X-API-Key auth, and every tool with its parameters is on that page. Every tool is POST https://api.sellermate.ai/public/v1/tools/{name} with a JSON body.

Build me a Google Apps Script that fills a Google Sheet from the SellerMate API every morning at 7am.

Three tabs, one per tool, each cleared and rewritten with yesterday-to-30-days-ago data:
- Campaigns: get_campaign_performance
- Targets: get_targeting_performance
- Search terms: get_search_term_performance

Columns in this order where present: date range, campaign, ad group, target or search term, impressions, clicks, spend (cost), sales (attributedSales14d), orders (purchases), ACoS, ROAS, CPC, CVR. Add a Summary tab with totals from each tool's summary object and a "last updated" timestamp.

Store the key with PropertiesService under SELLERMATE_API_KEY and read the account id from a Config tab. Walk every page using page and page_size 500.

Rules:
- My key is in the SELLERMATE_API_KEY environment variable. Send it as the X-API-Key header. Never hard-code it or log it.
- Call get_user_context first and use the accounts it returns. Don't invent account ids.
- Report tools are paginated (page, page_size up to 500, pagination.hasMore). Walk every page.
- On a 429, wait for the Retry-After header and retry. On a 401 or 403, stop and tell me.
- Show me the plan and the code before running anything that writes.

Stack: Google Apps Script. Include the trigger setup steps.

Fill in anything in [brackets] before you paste, or leave it and the assistant will ask. The first line sends it to the docs, where every tool is listed.

What you get

  • Three tabs of fresh performance data every morning
  • A summary tab with totals and a timestamp
  • A sheet the rest of the team can build formulas and charts on without touching the API

Before you paste

  • Read-only key, stored in script properties rather than a cell.
  • Thirty days of search terms on a big account can be tens of thousands of rows; narrow the date range if the script hits the Apps Script time limit.

Make it yours

Once it works, ask the assistant for one of these.

  • Append instead of rewrite to keep history.
  • Add a tab per Amazon account for agencies.
  • Point Looker Studio at the sheet for a client dashboard.
Book Demo