← Back to Documentation

Apps Script Setup

This guide explains the Google Apps Script integration that powers ShopSheets' auto-sync features.

What is Apps Script?

Google Apps Script is Google's automation tool for Sheets, Docs, and other Google Workspace apps. It lets you run custom code directly in your spreadsheets.

ShopSheets uses Apps Script to:

You don't need to write any code. ShopSheets automatically deploys the script when you create a sheet.


Automatic Installation

The Apps Script project is deployed automatically when you create a sheet from the ShopSheets dashboard.

What Gets Installed

  1. Apps Script Project named "ShopSheets Sync"
  2. Custom Menu - "ShopSheets" appears in the toolbar
  3. Menu Items:
    • Refresh Data
    • Setup Auto-Sync
  4. Configuration - API key and spreadsheet ID (pre-configured)

No manual setup required. Everything works out of the box.


ShopSheets Menu

After creating a sheet, you'll see a ShopSheets menu in the toolbar (next to Help).

Menu Items

1. Refresh Data

What it does: Manually triggers a sync from Shopify to update your sheet with the latest data.

When to use:

How to use:

  1. Click ShopSheetsRefresh Data
  2. Wait 5-30 seconds (depending on data volume)
  3. Toast message appears: "Syncing orders..."
  4. On completion: "Synced X orders" or "Synced X orders (from cache)"

Behind the scenes:


2. Setup Auto-Sync

What it does: Enables automatic data refresh when you change filters.

When to use:

How to use:

  1. Click ShopSheetsSetup Auto-Sync
  2. Grant permissions when prompted (one-time):
    • "See, edit, create, and delete all your Google Sheets spreadsheets"
    • "Connect to an external service"
  3. Toast message: "Auto-sync enabled"
  4. Now when you change filters, data refreshes within 2 seconds automatically

Behind the scenes:

Recommended: Enable auto-sync for the best experience.


Enabling Auto-Sync Triggers

Auto-sync requires one-time permission grant to install triggers.

Permission Flow

  1. Run Setup Auto-Sync (first time)
  2. Authorization popup appears:
    • "ShopSheets Sync wants to access your Google Account"
    • Shows required permissions
  3. Review permissions:
    • See, edit, create, and delete spreadsheets
    • Connect to an external service (ShopSheets API)
  4. Click "Allow"
  5. Auto-sync enabled - Filters now trigger automatic refresh

Why These Permissions?

ShopSheets only accesses the sheet it created. We cannot see other files in your Google Drive.

Revoking Permissions

If you want to revoke Apps Script permissions:

  1. Go to Google Account Permissions
  2. Find "ShopSheets Sync"
  3. Click Remove Access

Note: This disables auto-sync. Manual refresh still works.


Troubleshooting Apps Script

No "ShopSheets" Menu in Toolbar

Possible causes:

  1. Apps Script not loaded yet (can take 30 seconds on first open)
  2. Browser cache issue
  3. Apps Script deployment failed

Solutions:

  1. Reload the sheet - Press Ctrl/Cmd + R
  2. Check Extensions → Apps Script:
    • Should see "ShopSheets Sync" project
    • If missing, script didn't deploy correctly
  3. Try incognito mode - Rules out browser extension conflicts
  4. Create new sheet - If problem persists, create a new sheet from dashboard

"Script Not Configured" Error

What you see: Error message: "Script not configured. API configuration is missing."

Cause: Apps Script project is missing the API key (rare deployment issue)

Solution:

  1. Note your spreadsheet ID (from the URL: https://docs.google.com/spreadsheets/d/{SPREADSHEET_ID})
  2. Contact mail@minim-l.com with the spreadsheet ID
  3. We'll redeploy the script with the correct configuration

Temporary workaround:


Permission Denied Error

What you see: "You need authorization to perform this action"

Cause: Apps Script permissions not granted or revoked

Solution:

  1. Click ShopSheetsSetup Auto-Sync
  2. Grant permissions when prompted
  3. Click "Allow" (not "Deny")

If already granted:


Auto-Sync Not Working After Filter Change

What you see: Change a filter dropdown, but data doesn't refresh

Possible causes:

  1. Auto-sync trigger not installed
  2. Permissions denied
  3. Trigger was manually deleted

Solution:

  1. Run: ShopSheetsSetup Auto-Sync
  2. Grant permissions if prompted
  3. Change a filter to test - should sync within 2 seconds

Check trigger installation:

  1. Open ExtensionsApps Script
  2. Click Triggers (clock icon on left)
  3. Should see a trigger for onEdit
  4. If missing, run Setup Auto-Sync again

"Syncing Orders..." Appears But Nothing Happens

What you see: Toast message "Syncing orders..." but sheet doesn't update

Possible causes:

  1. Sync already in progress (wait for completion)
  2. Data is current (served from cache)
  3. Apps Script timeout (rare)

Solutions:

  1. Wait 30 seconds - Large datasets take time
  2. Check for completion toast - "Synced X orders" or "Synced X orders (from cache)"
  3. If "(from cache)" - Data is already up-to-date, no changes needed
  4. Try manual refresh from dashboard - Bypasses Apps Script

Toast Messages Keep Appearing

What you see: "Syncing orders..." toast appears repeatedly

Cause: Circular trigger loop (rare Apps Script bug)

Solution:

  1. Reload the sheet (Ctrl/Cmd + R)
  2. If persists, disable auto-sync:
    • Open ExtensionsApps Script
    • Click Triggers → Delete the onEdit trigger
  3. Use manual refresh instead: ShopSheetsRefresh Data
  4. Contact support if issue persists

Viewing Apps Script Logs

For advanced troubleshooting, you can view Apps Script execution logs.

How to Access Logs

  1. Open your sheet
  2. Click ExtensionsApps Script
  3. The script editor opens
  4. Click Executions (clock icon on left)
  5. See recent script runs with status (Success, Failure)

What to Look For

Common errors:


Advanced: Customizing the Script

Not recommended for most users. Modifying the script can break syncing.

If You Must Customize

  1. Open ExtensionsApps Script
  2. Edit the code
  3. Do NOT change:
    • API key configuration
    • Function names (onOpen, refreshData, setupAutoSync)
    • API endpoint URLs
  4. Safe to add:
    • Custom menu items (your own functions)
    • Additional logging

If you break the script:


Apps Script Quotas

Google Apps Script has daily quotas that affect how often you can sync.

Relevant Quotas (Free Google Account)

ShopSheets usage:

You're unlikely to hit quotas unless:

If you hit a quota:


Security & Privacy

What Data Does the Script Access?

The script does NOT:

Script Source Code

The script source is visible:

  1. Open ExtensionsApps Script
  2. Review the code yourself

Script hash verification:


Uninstalling the Script

If you want to remove the Apps Script project:

  1. Open ExtensionsApps Script
  2. Delete the "ShopSheets Sync" project
  3. The ShopSheets menu disappears
  4. Auto-sync stops working

Effects:

To reinstall:


Next Steps

Questions about Apps Script? Contact mail@minim-l.com