Schedule logo
Google Sheets logo
Cloudflare Workers KV logo

Workflow template

Publish website redirects from Google Sheets

Publish a checked table of same-site redirects in one KV write. Invalid rows leave the working table in place.

How it works

Publish website redirects from Google Sheets

1 Trigger · 2 Actions
Schedule1 · Trigger

Daily schedule

Run automatically on the configured schedule.

Google Sheets2 · Action

Read the redirect table

Call any Google Sheets API v4 operation with the connected account.

Cloudflare Workers KV3 · Action

Publish the checked redirect table

Check every source and destination before replacing the active redirect table in a single write. A conflicting row leaves the previous table available.

Before activation

Set up your workflow

  1. Prepare the two-column sheet

    Name the first two cells source and destination. Start with /old-guide and /guides/start in row 2. Use paths on your own site. Blank rows are ignored and each source must occur once.

  2. Select the spreadsheet and schedule

    Connect Google Sheets and enter /v4/spreadsheets/SPREADSHEET_ID/values/Redirects!A:B as the API path. Replace the ID and tab name, then choose how often the schedule should publish edits.

  3. Connect KV to your website

    Select the namespace in the publishing step. Bind that same namespace as ROUTES in your redirect Worker and keep its table key at redirects:active. The supplied Worker example reads this key for each request.

    Download the redirect Worker
  4. Test a redirect and a rejected edit

    Run the workflow, then request /old-guide without following redirects. Check for HTTP 301 and a Location ending in /guides/start. Add a second /old-guide row and rerun. The publish step should reject it and the original redirect should still work.

Explore connected apps