Automation Blog

Lookup Tables in Zapier: Formatter, Code Steps, and Storage

Three approaches to implementing lookup tables in Zapier — converting one value to another, mapping codes to labels, assigning territories from regions — using the Formatter Lookup Table transform for simple static maps, JavaScript objects in Code steps for multi-property mappings, and Zapier Storage for lookup data that changes without editing the Zap.

ZapierFormatterCode StepsData Mapping

By Troy Tessalone · · 5 minutes

Automation Guide

A practical field guide from Automation Ace.

Lookup Tables in Zapier: Formatter, Code Steps, and Storage

A lookup table maps an input value to a corresponding output value: state code → full state name, product SKU → price tier, country → currency, rep name → email address. In Zapier, you need this frequently — trigger data comes in one format, downstream apps expect another. There are three practical ways to implement lookup tables, each with different tradeoffs between simplicity, flexibility, and maintainability.

Option 1: Formatter Lookup Table Transform (No Code, Static Maps)

The Formatter by Zapier step includes a Lookup Table transform under the Utilities event. It's the no-code option for simple value-to-value mappings.

Setup

  1. Add a Formatter by Zapier → Utilities → Lookup Table step
  2. Set Lookup Key to the field whose value you want to map (e.g., State Code from the trigger)
  3. In the lookup table rows, add key-value pairs: CACalifornia, TXTexas, NYNew York, etc.
  4. Set a Fallback Value for keys that don't match any row (e.g., Unknown)

The step's output is a single Output field containing the matched value, or the fallback. Map it to any downstream field.

Best For

  • Simple one-to-one value conversions (code → label, abbreviation → full name)
  • Small tables (under ~20 rows) that rarely change
  • Zaps built by non-technical users who won't maintain code

Limitation: each Formatter Lookup Table step produces one output. For multi-property lookups (state code → full name + timezone + region), you need multiple Formatter steps or a Code step.

Option 2: JavaScript Object Map in a Code Step (Multi-Property, Static)

For lookups that return multiple values per key, or for tables with more than ~10 entries, a Code step with a plain JavaScript object is more efficient and easier to maintain than chaining multiple Formatter steps.

// Map product SKU to pricing tier, label, and support level
const skuMap = {
  'PRO-001':  { tier: 'enterprise', label: 'Enterprise Plan',  support: 'dedicated' },
  'PRO-002':  { tier: 'business',   label: 'Business Plan',    support: 'priority' },
  'PRO-003':  { tier: 'starter',    label: 'Starter Plan',     support: 'standard' },
  'FREE-001': { tier: 'free',       label: 'Free Plan',        support: 'community' }
};

const sku = inputData.sku;
const match = skuMap[sku] || { tier: 'unknown', label: 'Unknown SKU', support: 'none' };

output = {
  tier:    match.tier,
  label:   match.label,
  support: match.support,
  sku
};

Territory / Routing Lookup

// Map US state to sales rep email and region
const territoryMap = {
  'CA': { rep: 'sarah@company.com', region: 'West' },
  'OR': { rep: 'sarah@company.com', region: 'West' },
  'WA': { rep: 'sarah@company.com', region: 'West' },
  'TX': { rep: 'mike@company.com',  region: 'South' },
  'FL': { rep: 'mike@company.com',  region: 'South' },
  'NY': { rep: 'jane@company.com',  region: 'East' },
  'MA': { rep: 'jane@company.com',  region: 'East' }
};

const state = (inputData.state || '').toUpperCase().trim();
const territory = territoryMap[state] || { rep: 'general@company.com', region: 'Unassigned' };

output = {
  rep_email: territory.rep,
  region:    territory.region,
  state
};

Best For

  • Multi-property returns per key
  • Medium-sized tables (20–200 entries)
  • Lookup logic maintained by someone comfortable editing code
  • Case-insensitive matching (normalize with .toLowerCase() before the lookup)

Option 3: Zapier Storage for Dynamic Lookup Data

When the lookup table values change frequently — assignee lists, pricing tiers, territory maps updated by non-technical staff — hardcoding them in a Code step means editing the Zap every time. Zapier Storage lets you store the table as a JSON string and update it without touching the Zap.

Store the Lookup Table

Store the table in Zapier Storage as a JSON-serialized object. You can write it once via a setup Zap or directly via the Storage API:

// Write the lookup table to Zapier Storage (run once to initialize)
const storageSecret = inputData.storage_secret;
const lookupTable = {
  'CA': 'sarah@company.com',
  'TX': 'mike@company.com',
  'NY': 'jane@company.com'
};

await fetch('https://store.zapier.com/api/records', {
  method: 'POST',
  headers: { 'X-Secret': storageSecret },
  body: JSON.stringify({ territory_map: JSON.stringify(lookupTable) })
});

Read and Use the Lookup Table at Run Time

const storageSecret = inputData.storage_secret;

// Read the stored lookup table
const resp = await fetch(`https://store.zapier.com/api/records?secret=${storageSecret}`);
const stored = await resp.json();

let territoryMap = {};
try {
  territoryMap = JSON.parse(stored.territory_map || '{}');
} catch (e) {
  territoryMap = {};
}

const state = (inputData.state || '').toUpperCase();
const repEmail = territoryMap[state] || 'general@company.com';

output = { rep_email: repEmail, state };

For Zapier Storage setup and patterns, see the Zapier Storage API guide.

Best For

  • Lookup data updated by operations or non-technical staff without Zap edits
  • Large tables that would be unwieldy in a Code step
  • Shared tables used by multiple Zaps (one Storage key, many Zaps read from it)

Choosing the Right Approach

ApproachBest whenLimitation
Formatter Lookup TableSimple one-to-one, small table, no codeOne output per step, hard to scale
Code step object mapMulti-property, medium table, code okRequires Zap edit to update values
Zapier StorageDynamic data, updated without Zap editsAdds Storage API dependency and latency
Pick Formatter for simple value swaps, a Code step object for multi-property mappings you own, and Zapier Storage when the table is maintained by someone who shouldn't need to edit the Zap. The Code step object map is the most versatile — it's fast, readable, handles fallbacks cleanly, and can be extended to return multiple properties per lookup key in a single step.

For the Code step patterns used in the object map approach, see if/else and switch statements in Zapier Code steps. For storing and retrieving dynamic data with Zapier Storage, see the Zapier Storage API guide. For setting fallback default values when a lookup returns nothing, see default values with Zapier Formatter. For help designing a routing or value-mapping workflow, talk to Automation Ace.

ZapierFormatterCode StepsData Mapping

Disclaimer: This article may include links to apps, products, or services. Some links may be affiliate links, which means Automation Ace may earn a commission at no extra cost to you.

Build Better Systems

Ready to automate with confidence?

Share your tools, process, and goals. Automation Ace can design the workflow, integration, AI assist, or code bridge that fits your business.

Start a Project