Tips > Building Workflows

Implement Feature Flags Using a Google Sheet or Database

Feature flags let you change workflow behavior -- enable a new code path, toggle a notification, switch between API versions -- without editing the workflow

Feature flags let you change n8n workflow behavior without editing the workflow. Store each flag in a Google Sheet or database table, read them with a Google Sheets or database node at the start of the run, and parse them into an object with a Code node. Downstream IF nodes and expressions then branch on the flag values.

What are feature flags in n8n?

Feature flags let you change workflow behavior -- enable a new code path, toggle a notification, switch between API versions -- without editing the workflow itself. Store flags in a Google Sheet or database table and read them at the start of your workflow. This decouples deployment from configuration.

Real-world example: A workflow processes orders differently based on feature flags stored in a Google Sheet. The operations team can toggle flags without touching n8n.

How do you store feature flags in a Google Sheet?

Google Sheet structure ("Feature Flags" sheet):

Flag Name Value Description Updated By Updated At
enable_new_shipping true Use new shipping rate API ops-lead 2025-03-10
email_notifications true Send order confirmation emails marketing 2025-03-08
max_retry_attempts 5 Max retries for payment API eng-lead 2025-03-01
maintenance_mode false Reject all new orders ops-lead 2025-02-28
ab_test_checkout B Checkout flow variant A or B product 2025-03-12

How do you read and use feature flags in a workflow?

Read flags at workflow start:

[Trigger] → [Google Sheets: Read "Feature Flags"] → [Code: Parse Flags] → [Rest of Workflow]

Code node to parse flags into a usable object:

const flagRows = $input.all();
const flags = {};

for (const row of flagRows) {
  const name = row.json['Flag Name'];
  let value = row.json['Value'];

  // Type coercion
  if (value === 'true') value = true;
  else if (value === 'false') value = false;
  else if (!isNaN(value) && value !== '') value = Number(value);

  flags[name] = value;
}

return [{ json: { flags } }];

Use flags in downstream IF nodes:

// IF node: Check maintenance mode
{{ $('Parse Flags').first().json.flags.maintenance_mode === true }}
  → true: Respond with "System under maintenance" and exit
  → false: Continue processing

// IF node: Choose shipping API
{{ $('Parse Flags').first().json.flags.enable_new_shipping === true }}
  → true: Use new shipping rate API
  → false: Use legacy shipping rate API

// Expression in Retry settings
Max retries: {{ $('Parse Flags').first().json.flags.max_retry_attempts }}

Tip: Cache Flags for Performance. If your workflow runs frequently (e.g., per webhook), reading a Google Sheet on every execution adds latency. Use a scheduled workflow that reads flags every 5 minutes and writes them to an n8n static data store or a fast key-value store like Redis.

Feature flags give non-technical team members a safe control panel for workflow behavior without risking accidental workflow edits.

Related: Always Set an Error Workflow on Every Production Workflow · Use "Pin Data" to Freeze Node Output

Showcase builds

19 complete workflows from my own projects, each with its n8n workflow JSON to import. Showcase entries link the file at the end of the article.

See the showcase builds

Keep reading

190 entries grouped by topic, from first workflow to queue mode. Free, no signup.

Browse the encyclopedia

Need it built?

I design, build and run n8n systems for clients. Every engagement starts with a $1,500 diagnostic audit, credited toward the build.

Book an introductory call