Get Variables

Fetch variables from an n8n DataTable and merge into workflow data, or create a new Variables table

Get Variables

AI-generated

Summary

Fetches rows from an n8n DataTable via the n8n public API, converts them into a key/value object, and merges it into each incoming item (or emits it as a single item if there is no input).

Inputs

  • DataTable (required) — The DataTable to read from, chosen from a list loaded from the n8n API (/api/v1/data-tables).
  • Key Column (required) — Column holding the variable name. Defaults to 'variable_key'. Rows with an empty key are skipped.
  • Value Column (required) — Column holding the variable value. Defaults to 'variable_value'.
  • Variable Keys — Multi-select of keys to include, loaded from the table's key column. Leave empty to include all variables.

Output shape

A list of items. Each input item's JSON is returned with the variables merged in as top-level fields (variable name -> value). With no input items, a single item containing only the variables is returned.

Requires an n8nApi credential (base URL and API key). Variable names override same-named fields on the input item. Only a single request to the rows endpoint is made, with no pagination handling, so large tables may be truncated by the API's default page size. Values are returned exactly as stored in the Value Column.

Examples

Example 1: Load all config values from a variables table at the start of a workflow.

Select DataTable, keep default Key Column 'variable_key' and Value Column 'variable_value', leave Variable Keys empty.

Example 2: Attach only an API URL and token to incoming records for later HTTP nodes.

Select DataTable, set Variable Keys to 'api_url' and 'api_token'; downstream nodes read them as {{ $json.api_url }}.

Links

Discussion