company logo

Help center

Go to Multifeeds
All collectionsAdd-onsData sources for lookup

Data sources for lookup

Create reusable lookup tables and reference them in expressions with the lookup() function.

Data sources for lookup lets you create reusable lookup tables and reference them in your feed expressions with the lookup() function. This lets you inject external data (price sheets, category codes, translated labels, sales figures, and more) into each product when the feed is built, without entering values by hand.

Open the feature at Settings → Data sources (/settings/datasources).


On this page

  • When to use it

  • How it works

  • Data source types

  • Common options

  • Using it in an expression with lookup()

  • Checking a source

  • Cache and performance

  • Pricing

  • Troubleshooting

  • FAQ


When to use it

Use a data source when you have a key → value table and need to look up that value for each product/variant while the feed is built. For example:

  • A dedicated price list per SKU or per product group.

  • A mapping from Shopify product codes to internal supplier IDs / GTINs.

  • A table for translating category names or custom labels.

  • Sales figures pulled from Shopify (ShopifyQL) to flag "best sellers".

In short: if you need to "look up a value by key" for every product, use a data source instead of hard-coding it into each rule.


How it works

  1. You declare a data source with a Name, Type, Key column, Value column, and a data origin (a CSV URL, a Google Sheet URL, or a Shopify query).

  2. When the feed is built, the app reads the origin and builds a lookup table named t#<Name> — for example, a data source named Pricing sheet produces the token t#Pricing sheet.

  3. In a feed expression you call lookup("{token}", 't#<Name>') to fetch the matching value.

Key points:

  • In the expression editor (RuleEditor), these tables appear under the Lookup tables group, shown as Table "<Name>".

  • Every saved data source is loaded when a feed runs, not only sources an expression references. Remove sources you no longer use.

  • Data sources are not built for feeds with Type = API (only file-based feeds apply: CSV, TSV, XML, JSON, etc.).

  • Each data source must have a unique Name (case-insensitive).


Data source types

1. CSV file

Use a CSV/TSV file hosted at a public URL.

Field

Required

Notes

CSV file URL

Yes

Must be an http:// or https:// URL

Key column

No

Defaults to 1

Value column

No

Defaults to 2

  • The delimiter is auto-detected from the URL: if the URL contains tqx=out:tsv, ends with .tsv, or includes format=tsv, a tab is used; otherwise a comma.

2. Google sheet

Use a publicly shared Google Sheet.

Field

Required

Notes

Google sheet URL

Yes

Format: https://docs.google.com/spreadsheets/d/{sheetId}/edit

Sheet title

No

Leave blank to use the first sheet

Key column

No

Defaults to 1

Value column

No

Defaults to 2

  • The sheet must be shared as "Anyone with the link".

  • Data is read through Google's CSV export endpoint (gviz/tq?tqx=out:csv), so the sheet should be a table with a clear header row.

3. Shopify query

Use a ShopifyQL query to pull figures from Shopify.

Field

Required

Notes

Query string

Yes

Example: FROM sales SHOW product_id, total_sales GROUP BY product_id SINCE -90d LIMIT 1000

Key column

No

Defaults to 1

Value column

No

Defaults to 2

  • This type requires the read_reports scope. If it is missing, the UI shows an Additional permission required banner with a Grant access button.

  • The result's header row is used as column names; Key column and Value column are 1-based positions in the returned result.


Common options

Every data source has the following fields (in the top-right of each block):

  • Name — identifier, required and must be unique. This name is the part after t# in the reference token.

  • Type — CSV file, Google sheet, or Shopify query.

  • Key column — 1-based column used as the key.

  • Value column — 1-based column holding the returned value.

Status badges for each block:

Badge

Meaning

New

Data source just added, not saved yet

Modified

Has unsaved changes

Free

Within the shop's free data source allowance

Click Save on the save bar (ContextualSaveBar) to save; Discard to revert changes.


Using it in an expression with lookup()

Syntax:

JavaScript
lookup(key, map, arrayOption?)

Parameter

Description

key

The value to look up. Usually a product token, e.g. '{sku}', '{product_id}', '{g:id}'.

map

The table reference as a single-quoted string: 't#<Name>', e.g. 't#Pricing sheet'.

arrayOption

(Optional) How to handle a key that appears multiple times: 'array', 'first', 'last'. Omitted returns the raw value.

Example:

JavaScript
lookup('{sku}', 't#Pricing sheet')

If a key appears on multiple rows, values are grouped; use arrayOption to choose:

JavaScript
lookup('{product_id}', 't#Best sellers', 'first')

Inserting the token quickly: in the RuleEditor, open the token list and pick under Lookup tables → Table "<Name>". The t#<Name> token is inserted into the expression.

Besides lookup(), you can reference a table as a variable using the t#<Name> token itself where supported (the table is added to the expression context during a build).


Checking a source

When you add a URL, sheet, or query, the page reads the source and shows how many rows it found.

  • Fewer than 1,000 rows: that count is exact.

  • The read stops after 1,000 rows: the page says the file is longer than 1,000. The usage estimate uses 1,000 until the next feed run measures the full file.

  • A feed run replaces that estimate with the full row count.

To check that a key returns the value you expect, save the source, reference it with lookup() in a feed expression, and use feed preview.


Cache and performance

  • A lookup table can be reused for 30 minutes after it is built, including by a later feed run or a preview. That reuse does not change the bill.

  • Each feed run counts every saved data source once, whether the table was read again or reused. Looking up a value for each product does not count. A product update between two runs does not count as another reload.

  • Every saved data source is loaded when a feed runs, not only sources an expression references. Remove sources you no longer use: that stops their monthly credit. Row-reads already counted in the current billing period still count.


Pricing

Data sources require a paid plan (MultiFeed-1K or higher). 1 credit = 1 USD. Each saved data source, whether it is a CSV file, a Google Sheet, or a Shopify query, costs 1 monthly credit.

That credit includes 300,000 row-reads in the 30-day billing period. A row-read is one row of a source counted each time a scheduled feed run reads that source. Reading a 10,000-row table once a day is 300,000 row-reads, the amount included. “Once a day” is an example of that allowance, not a daily reset. Looking up a value for each product does not add row-reads. Gifted sources (the Free badge) include the same 300,000 row-reads.

After that, further row-reads are $1 per 300,000, up to $120 per billing period. One read of a source cannot exceed 100,000 rows. A larger file or query fails with an error and is not billed: filter it or split it into smaller sources.

Deleting a source stops its monthly credit. Row-reads already counted in the period stay on the usage total.

Examples in one billing period

  • 1 price sheet of 800 rows, feed once a day: 24,000 row-reads. $1, usage $0.

  • 3 small sources: $3, usage $0.

  • 1 file of 10,000 rows, once a day: 300,000 row-reads. $1, usage $0.

  • 1 file of 100,000 rows, once a day: 3,000,000 row-reads, minus 300,000 included, $9 usage, plus the $1 credit.

  • 1 file of 100,000 rows, 4 times a day: 12,000,000 row-reads, minus 300,000 included, $39 usage, plus the $1 credit.

  • Usage is capped at $120 per billing period (36,000,000 row-reads beyond the included amount).


Troubleshooting

Symptom

Likely cause

Fix

More than 100,000 rows

The file or query is over the per-reload limit

Filter the origin or split it into smaller sources

LookupError while building the feed

The origin failed (bad URL, private sheet, invalid query)

Check the message on the data source, then check the URL, sharing settings, or query syntax

Lookup always returns "Not found"

Wrong Key column, or the key does not match

Verify the key column in the data; check the value passed as the key

Empty result even though the key exists

Wrong Value column, or the value cell is empty

Check Value column (1-based); the No data badge points to the value column

Google Sheet cannot be read

The sheet is not shared publicly

Change sharing to "Anyone with the link"

Shopify query is blocked

Missing the read_reports scope

Click Grant access on the banner to grant it

Old data keeps appearing

The table was built in the last 30 minutes

Re-run the feed after 30 minutes, or change the source URL so the next run reads it again

Duplicate data source name error

Name must be unique (case-insensitive)

Use a different name


FAQ

Do I need the single quotes around 't#...'? Yes. The table is passed as a single-quoted string, e.g. lookup('{sku}', 't#Pricing sheet').

Will renaming a data source break expressions? Possibly. The t#<Name> token is tied to the data source name, so after renaming you must update any expressions that referenced the old name.

Is Key column / Value column 0-based or 1-based? 1-based (the first column is 1).

A key has multiple values — which one is returned? By default the raw value is returned (which may be an array when a key repeats). Use arrayOption 'first' / 'last' / 'array' to control this.


See also: Add-ons.