OpenRefine icon

OpenRefine

OpenRefine is an open-source desktop application for data wrangling

Actions10

Expression → Preview

AI-generated

Overview

This node integrates with an OpenRefine server to perform various data wrangling tasks. Specifically, the Expression: Preview operation allows users to preview the result of an OpenRefine expression on selected rows and columns of a project before applying it. This is useful for testing and validating expressions to ensure they produce the desired transformation or extraction from the dataset.

Typical use cases include:

  • Testing complex data transformation expressions on sample rows.
  • Validating data cleaning formulas before bulk application.
  • Experimenting with OpenRefine's expression language interactively within an automated workflow.

For example, you might preview a text transformation expression on the first two rows of a specific column to verify that it correctly formats dates or extracts substrings.

Properties

Name Meaning
Server The URL of the OpenRefine server to connect to. Default is http://127.0.0.1:3333. Change this if your OpenRefine instance runs on a different address or port.
Project ID The identifier of the OpenRefine project where the expression will be previewed.
Column Index Zero-based index of the column on which to preview the expression. For example, 0 means the first column.
Row Indices A JSON string representing an array of zero-based row indices on which to preview the expression. For example, [0,1] previews on the first two rows.
Expression The OpenRefine expression string to preview. Must be a valid expression according to OpenRefine's expression language.
Repeat Boolean flag indicating whether to repeat the expression multiple times. Useful for testing expressions that may yield different results on subsequent runs.
Repeat Count Number of times to repeat the expression when Repeat is true. Minimum value is 1. Defaults to 1.

Output

The node outputs an array of JSON objects representing the preview results returned by the OpenRefine server. Each object corresponds to the evaluation of the expression on the specified rows and column. The exact structure depends on OpenRefine's response but typically includes:

  • The evaluated values of the expression for each requested cell.
  • Metadata about the preview such as status codes or messages.

No binary data output is produced by this operation.

Dependencies

  • Requires access to a running OpenRefine server reachable at the specified Server URL.
  • No special API keys or authentication tokens are required by default, but the node fetches a CSRF token from the server to authorize requests.
  • The node uses HTTP requests to communicate with OpenRefine's REST API endpoints.

Troubleshooting

  • Connection errors: Ensure the OpenRefine server URL is correct and the server is running and accessible from n8n.
  • Invalid Project ID: Verify that the project ID exists on the OpenRefine server.
  • Malformed Expression: If the expression is invalid, OpenRefine may return an error or empty results. Validate expressions using OpenRefine's UI or documentation.
  • Row Indices format: The Row Indices property must be a valid JSON array string (e.g., [0,1,2]). Invalid JSON will cause request failures.
  • CSRF Token errors: If the node cannot retrieve a CSRF token, check the OpenRefine server configuration and network connectivity.
  • Repeat Count issues: When Repeat is enabled, ensure Repeat Count is at least 1; otherwise, the request may fail or behave unexpectedly.

Links and References

Discussion