Functions to extract information from unstructured text.
Click here to learn how to use Extract Wrangles in Excel.
Extract geographical information from unstructured text such as streets, cities or countries.
wrangles:
- extract.address:
input: Location
output: Street
dataType: streets
where: SUBSTRING(Location, 1, 3) = '221'
| Location | Street |
|---|---|
| 221 B Baker St., London, England, United Kingdom | ['221 B Baker St.'] |
| London SW1A 1AA, London, England, United Kingdom |
| Parameter | Required | Data Type | Notes |
|---|---|---|---|
| input | ✓ | str, list | |
| output | ✓ | str, list | |
| dataType | ✓ | streets / cities / regions / countries | Specific part of the address to extract |
| where | str | Filter the data to only apply the wrangle to certain rows using an equivalent to a SQL where criteria, such as column1 = 123 OR column2 = 'abc' | |
| output_format | string | Format of the extract output Allowed values: list, columns, concatenate. |
|
| char | string | Character to use when output_format is concatenate | |
| where_params | str | Variables to use in conjunctions with where. This allows the query to be parameterized. This uses sqlite syntax (? or :name) | |
| if | str | A condition that will determine whether the action runs or not as a whole. |
Extract structured attributes from each row using an AI model. Define attributes in the recipe or reuse a saved extraction model. The configured default uses OpenAI Responses; Chat Completions remains a compatibility option.
read:
- test:
rows: 1
values:
Product Specs: 'Saw with a 4.5 inch blade and maximum speed of 3600 rpm.'
wrangles:
- extract.ai:
api_key: ${OPENAI_API_KEY}
input: Product Specs
instructions: Extract only supported values; return null when absent.
output:
Blade Diameter:
type: number
description: Blade diameter in inches, as a number without a unit suffix.
examples: [4.5, 8]
Max. RPM:
type: integer
description: Maximum rotations per minute, as an integer.
examples: [3600]
Illustrative output (AI results may vary):
| Product Specs | Blade Diameter | Max. RPM |
|---|---|---|
| Saw with a 4.5 inch blade and maximum speed of 3600 rpm. | 4.5 | 3600 |
wrangles:
- extract.ai:
api_key: ${OPENAI_API_KEY}
input: Product Specs
model_id: ${EXTRACT_MODEL_ID}
output: Attributes
output_format: dictionary
With model_id, the saved model supplies the attribute schema. output names the destination column or columns; it does not replace the saved schema.
| Parameter | Required | Data Type | Notes |
|---|---|---|---|
| input | string, integer, array | Input column name, column index, or list of columns supplied together as DATA for each row. If omitted, all dataframe columns are supplied. | |
| output | object, string, array | Desired extraction. Use an object keyed by output column name for structured fields, a string for one prompted value, or an array of field names/definitions. Each field may use the schema options below. | |
| record_examples | array, object | Whole-record examples. Each example has a separate input value or record and the complete expected output record. Optional name and notes provide model-visible context. Use {name: ..., notes: ..., input: ..., output: ...}. Omitted nullable output fields are completed with null. Required non-null nested properties must be supplied. This differs from examples nested under one output field, which teach only that field. | |
| api_key | ✓ | string | OpenAI API key used for this wrangle, normally supplied through a recipe variable. |
| model | string | OpenAI model ID for this call. If omitted, uses the configured extract.ai default; a saved model definition may supply its own model. | |
| threads | integer | Maximum number of row-level requests sent in parallel. The configured default is 32. | |
| timeout | number | Network timeout in seconds for each HTTP attempt. The configured default is 12. Each retry uses the same timeout. | |
| retries | integer | Number of additional attempts per row after a retryable failure. The configured default is 1. Retry delays are separate from timeout. | |
| url | string | Override the endpoint for the selected protocol. A chat/completions URL selects the legacy protocol only when protocol is omitted; new recipes should use the configured Responses endpoint. | |
| provider | string | AI service provider. Currently only OpenAI is supported. Allowed values: openai. |
|
| protocol | string | OpenAI API protocol. Responses is the configured default and is required for web_search; chat_completions remains available for legacy definitions. Allowed values: responses, chat_completions. |
|
| store | boolean | Whether OpenAI may store Responses API results. Defaults to true. | |
| metadata | object | Labels attached to OpenAI requests, such as recipe_name and wrangles_user. Available recipe name and Wrangles user are added automatically. Explicit labels override those defaults; an empty object disables automatic labels. These appear with stored logs and are separate from model instructions. Up to 16 string pairs; keys may contain up to 64 characters and values up to 512 characters. Does not enable workflow tracing. | |
| cache | boolean | Reuse identical successful results from the bounded warm-instance cache. Defaults to true. Set false when fresh model or web results are required. | |
| cache_ttl | number | Maximum age in seconds for a cached result used by this call. Applies to extracted values and web_search_sources together. | |
| messages | str, list | Legacy alias for general instructions. Prefer instructions in new recipes. |
|
| instructions | string, array | General instructions applied to every input row, in addition to any GeneralInstructions in the saved model. Use this for decision rules, evidence priorities, normalization requirements, or other behavior that applies to the complete extraction. | |
| model_id | string | ID of a saved extract.ai definition. Use it instead of defining an output schema. When output is also supplied with model_id in a recipe, output names the destination column or columns for the saved fields. | |
| strict | boolean | Require OpenAI structured-output strict mode. Defaults to true. Definitions with dynamic dictionary keys automatically switch to non-strict provider mode and are still validated locally. | |
| output_format | string | How extracted fields are written. columns writes one dataframe column per field (default); dictionary keeps one object; concatenate joins fields into one string using char. Allowed values: dictionary, columns, concatenate. |
|
| char | string | Separator used only when output_format is concatenate. Defaults to comma-space. | |
| reasoning | string, object | Reasoning effort, such as none or low, or an object with effort and other reasoning options. Both forms are equivalent for setting effort. Defaults to none for every model. Explicit settings are always sent to the provider; unsupported settings produce a provider error. | |
| verbosity | string | Responses API text verbosity for compatible models. Defaults to low when supported; ignored with a warning for incompatible models. Allowed values: low, medium, high. |
|
| web_search | boolean | Enable OpenAI Responses web search; the model decides when searching helps. When true, every row also receives web_search_sources: a deduplicated list of {title, url} objects in source order, or an empty list when no source was used. This reserved column is automatic. Requires protocol responses. Defaults to false. | |
| where | str | Apply to rows matching a SQL WHERE expression. | |
| where_params | list, object | Values for positional (?) or named (:name) WHERE parameters. | |
| if | str | Condition controlling whether the whole wrangle runs. |
| Parameter | Required | Data Type | Notes |
|---|---|---|---|
| type | string | JSON data type required for this field. If omitted, common scalar types are accepted. Fields allow null by default. Allowed values: string, number, integer, boolean, null, object, array. |
|
| description | string | Plain-language definition of the value to extract, including any selection, normalization, unit, or evidence rules. | |
| enum | array | Allowed output values. The model must choose one of these values; null is also allowed unless nullable is false. | |
| default | string, number, integer, boolean, null, object, array | JSON Schema annotation for a preferred default. extract.ai does not substitute this value when evidence is missing; describe fallback behavior explicitly or allow null. | |
| examples | array, object, string, number, integer, boolean, null | Field-specific examples. The backward-compatible form is a scalar or list of typical output values. A paired example may instead use input and output, with optional name and notes. Paired examples apply only to this output field; use record_examples for complete output records. Object outputs must include every required non-null nested property. | |
| properties | object, array, string | Child fields when type is object. Use an object to define a schema for each child. A list or comma-separated string is a shortcut that creates fixed child names. Named child values are non-null by default. | |
| required | array, string | Named object properties that must be returned. If omitted, every named property is required. Strings may use pipe or comma delimiters. | |
| additionalProperties | boolean, object | Controls keys beyond properties when type is object. Set false for fixed keys, true for arbitrary values, or provide one schema applied to every dynamic value. Dynamic dictionaries use non-strict provider mode plus local validation. Defaults to false when named properties exist. | |
| items | object | Schema applied to every element when this field's type is array. | |
| nullable | boolean | Whether the field may return null. Defaults to true while a top-level field key remains required. Named nested properties default to false. Set this explicitly to override the applicable default. |
Top-level output keys are always returned and are nullable by default. Named nested properties default to required and non-null; objects with named properties are closed unless configured otherwise. Dynamic dictionaries use non-strict provider mode with local validation.
default is a schema annotation, not a guaranteed substitution for missing evidence. Keep examples consistent with the declared type: use 4.5 for a number, not 4.5 inches. Describe missing-value behavior in instructions or fill values in a later wrangle.
examples under one attribute teach that field. Paired examples use input and output; record_examples teach the complete output record. Required non-null nested properties must be present in examples.
Omitting model follows the active AI configuration; a saved definition may supply its own model. The v1.20.5 packaged extraction role selects gpt-6-luna. This is a package default, not a guarantee of provider availability. See AI Configuration to override the catalog.
Packaged runtime defaults are 32 workers, a 12-second timeout per HTTP attempt, one additional retry, strict structured output, reasoning effort none, and store: true. An explicit call can override these values. Each retry gets its own timeout; queueing and retry delay are separate. A complete batch can therefore take longer than one timeout.
Use instructions for general guidance. The legacy messages alias remains supported. Runtime instructions append to saved General Instructions. reasoning: none and reasoning: {effort: none} are equivalent; verbosity is separate. Unsupported model settings can produce provider errors.
web_search: true requires Responses. Search sources are returned in web_search_sources. Sources and extracted values are cached together. Set cache: false for fresh results, or use cache_ttl to limit cached result age. Cached successful results are reused within a warm runtime, not guaranteed across independent processes.
store: false disables Responses storage for the call. Storage and local result caching are separate. Effective store and metadata participate in cache identity. Available recipe/user labels are attached automatically; explicit metadata overrides them, and metadata: {} disables automatic labels.
For legacy Chat Completions definitions, set protocol: chat_completions; a chat/completions URL selects that protocol when protocol is omitted. store is not forwarded on this compatibility path. Do not describe a custom URL as supporting only Chat Completions.
For list-producing extract wrangles, output_format: list keeps results in one cell, columns distributes results across output columns, and concatenate joins them with char. An explicit output_format takes precedence. Without one, a list of output names selects column output, including a list containing only one name. To retain a list in one cell, explicitly use output_format: list.
Dictionary-producing modes support dictionary or columns; list and concatenate formats are not valid for dictionary-producing modes. extract.ai has its own documented formats above.
wrangles:
- extract.codes:
input: Description
output: Codes
output_format: list
- extract.codes:
input: Description
output: [First Code]
output_format: columns
Extract numeric attributes from unstructured text such as lengths or voltages.
wrangles:
- extract.attributes:
input: tools
output: attributes
responseContent: span
| Tools | Attributes (Span) |
|---|---|
| hammer 5kg, 0.5m | {'length': ['0.5m'], 'mass': ['5kg']} |
| Tools | Attributes (Object) |
|---|---|
| hammer 5kg, 0.5m | {'length': [{'unit': 'metre', 'value': 0.5}], 'mass': [{'unit': 'kilogram', 'value': 5.0}]} |
wrangles:
- extract.attributes:
input: Tools
output: attributes
responseContent: span
attribute_type: mass # Specific attributes
| Parameter | Required | Data Type | Notes |
|---|---|---|---|
| input | ✓ | str, list | |
| output | ✓ | str, list | |
| responseContent | span / object | If omited defaults to span (text found). Object returns an object with the value and unit. | |
| attribute_type | See list of options below | Specify which attributes to return, if omitted defaults to all | |
| desired_unit | str | Convert the extracted unit to the desired unit | |
| bound | min/ mid/ max | When returning an object, if the input is a range (e.g. 10-20mm) set the value to return. min, mid or max. Default mid. | |
| output_format | string | Format of the extract output Allowed values: list, dictionary, columns, concatenate. |
|
| char | string | Character to use when output_format is concatenate | |
| first_element | bool | Get the first element from results, defaults to False. | |
| where | str | Filter the data to only apply the wrangle to certain rows using an equivalent to a SQL where criteria, such as column1 = 123 OR column2 = 'abc' | |
| where_params | str | Variables to use in conjunctions with where. This allows the query to be parameterized. This uses sqlite syntax (? or :name) | |
| if | str | A condition that will determine whether the action runs or not as a whole. |
List of Attributes:
Extract text properties in brackets from the input
wrangles:
- extract.brackets:
input: Data
output: Output
| Data | Output |
|---|---|
| {Hello} | Hello |
| [Wrangles] | Wrangles |
| (!) | ! |
| <!> | ! |
| Parameter | Required | Data Type | Notes |
|---|---|---|---|
| input | ✓ | str, list | |
| output | ✓ | str, list | |
| first_element | bool | Get the first element from results, defaults to False. | |
| where | str | Filter the data to only apply the wrangle to certain rows using an equivalent to a SQL where criteria, such as column1 = 123 OR column2 = 'abc' | |
| output_format | string | Format of the extract output Allowed values: list, columns, concatenate. |
|
| char | string | Character to use when output_format is concatenate | |
| where_params | str | Variables to use in conjunctions with where. This allows the query to be parameterized. This uses sqlite syntax (? or :name) | |
| find | str, list | The type of brackets to find (round '()', square '[]', curly '{}', angled '<>'). Default is all brackets. | |
| include_brackets | bool | Include the brackets in the output | |
| if | str | A condition that will determine whether the action runs or not as a whole. |
Extract alphanumeric codes from unstructured text. Can be performed on one column or multiple columns.
# One column input
wrangles:
- extract.codes:
input: Secret
output: Code Extract
| Secret | Code Extract |
|---|---|
| to gain access use Z1ON0101 | ['Z1ON0101'] |
# Multi column input
wrangles:
- extract.codes:
input:
- code1
- code2
output: Codes
| code1 | code2 | Codes |
|---|---|---|
| code CH465517080-1 | code CH465517080-2 | ['CH465517080-1', 'CH465517080-2'] |
| Parameter | Required | Data Type | Notes |
|---|---|---|---|
| input | ✓ | str, list | |
| output | ✓ | str, list | |
| first_element | bool | Get the first element from results, defaults to False. | |
| min_length | str, int | Minimum length of allowed results | |
| max_length | str, int | Maximun length of allowed results | |
| strategy | str | How aggressive to be at removing false positives such as measurements (lenient, balanced, or strict). | |
| sort_order | str | input (default) retains input order; longest and shortest sort by code length. Equal-length matches retain input order. |
|
| disallowed_patterns | str | A pattern or JSON array of regex patterns to not include in the found codes | |
| include_multi_part_tokens | bool | Whether to include multi-part tokens that have a space. Default True. | |
| extract_raw | bool | Include adjacent non-whitespace characters around the detected token instead of returning only the cleaned token. Default False. |
|
| where | str | Filter the data to only apply the wrangle to certain rows using an equivalent to a SQL where criteria, such as column1 = 123 OR column2 = 'abc' | |
| output_format | string | Format of the extract output Allowed values: list, columns, concatenate. |
|
| char | string | Character to use when output_format is concatenate | |
| where_params | str | Variables to use in conjunctions with where. This allows the query to be parameterized. This uses sqlite syntax (? or :name) | |
| if | str | A condition that will determine whether the action runs or not as a whole. |
Extract data from the input using a DIY or bespoke extraction wrangle. Can be performed on one column or multiple columns.
It is important to note that (non-regex) pattern matching extracts match whole words that are separated by word boundaries. Word boundaries include anything that is not a letter, number or an underscore.
# One column input
wrangles:
- extract.custom:
input: Product
output: Wood Types
model_id: model_id_here
| Product | Wood Types |
|---|---|
| Dining Oakwood Chair | Oakwood |
| Living Room Teakwood Frame Mirror | Teakwood |
# Multi column input
wrangles:
- extract.custom:
input:
- Part 1 of 2
- Part 2 of 2
output: Wood Types
model_id: model_id_here
| Part 1 of 2 | Part 2 of 2 | Wood Types |
|---|---|---|
| Dining Acacia Wood Table | Imitation Wood Table Chairs | ['Acacia Wood', 'Imitation Wood'] |
# Multiple Models
wrangles:
- extract.custom:
input:
- Product
- Product
output:
- Wood Types
- Item Type
model_id:
- wood_Type_model_id
- item_type_model_id
| Product | Wood Types | Item Type |
|---|---|---|
| Dining Oakwood Chair | Oakwood | Chair |
| Living Room Teakwood Frame Mirror | Teakwood | Mirror |
| Parameter | Required | Data Type | Notes |
|---|---|---|---|
| input | ✓ | str, list | |
| output | ✓ | str, list | |
| model_id | ✓ | str, list | Model id of the custom Extract Wrangle being used. |
| use_labels | bool | Adds labels (if given) to the extracted data, defaults to false. See here for more information. | |
| first_element | bool | If true, returns only the first element of matched values. | |
| case_sensitive | bool | Allows the wrangle to be case sensitive if set to True, default is False. | |
| use_spellcheck | bool | Use spellcheck to correct spelling mistakes in the input. | |
| sort | str | Sort the results based on length, training data, input data alphabetical etc. Allowed values: training_order, input_order, longest, shortest, alphabetical, reverse_alphabetical, ascending, descending. | |
| extract_raw | bool | Extract the raw data from the wrangle. | |
| where | str | Filter the data to only apply the wrangle to certain rows using an equivalent to a SQL where criteria, such as column1 = 123 OR column2 = 'abc' | |
| output_format | string | Format of the extract output Allowed values: list, dictionary, columns, concatenate. |
|
| char | string | Character to use when output_format is concatenate | |
| include_empty_labels | boolean | Include labels with no found values in the output when using use_labels=True | |
| where_params | str | Variables to use in conjunctions with where. This allows the query to be parameterized. This uses sqlite syntax (? or :name) | |
| if | str | A condition that will determine whether the action runs or not as a whole. |
Note: When using an AI based extract, the output will be returned as a dictionary.
Extract date properties from a date (day, month, year, etc...)
wrangles:
- extract.date_properties:
input: Date
output: Output
property: month_name
| Date | Output |
|---|---|
| 1992-08-13 00:00:00 | August |
| Parameter | Required | Data Type | Notes |
|---|---|---|---|
| input | ✓ | str | |
| output | str | If not given, overwrites input | |
| property | ✓ | day / day_of_year / month / month_name / weekday / week_day_name / week_year / quarter | Property to extract from date |
| where | str | Filter the data to only apply the wrangle to certain rows using an equivalent to a SQL where criteria, such as column1 = 123 OR column2 = 'abc' | |
| where_params | str | Variables to use in conjunctions with where. This allows the query to be parameterized. This uses sqlite syntax (? or :name) | |
| if | str | A condition that will determine whether the action runs or not as a whole. |
Extract date range from two dates
wrangles:
- extract.date_range:
start_time: Start
end_time: End
output: Output
range: months
| Start | End | Output |
|---|---|---|
| 1992-08-13 00:00:00 | 2023-08-13 00:00:00 | 371 |
| Parameter | Required | Data Type | Notes |
|---|---|---|---|
| start_time | ✓ | str | Name of the start date column |
| end_time | ✓ | str | Name of the end date column |
| output | ✓ | str | Name of the output column |
| range | See below for options | Type of frequency to count, defaults to day | |
| where | str | Filter the data to only apply the wrangle to certain rows using an equivalent to a SQL where criteria, such as column1 = 123 OR column2 = 'abc' | |
| where_params | str | Variables to use in conjunctions with where. This allows the query to be parameterized. This uses sqlite syntax (? or :name) | |
| if | str | A condition that will determine whether the action runs or not as a whole. |
Range options:
Extract Text and Links from HTML Elements
wrangles:
- extract.html:
input: HTML
output: Text
data_type: text
| HTML | Text |
|---|---|
<a href="https://www.wrangleworks.com/">Wrangle Works!</a> |
Wrangle Works! |
wrangles:
- extract.html:
input: HTML
output: Links
data_type: links
| HTML | Links |
|---|---|
<a href="https://www.wrangleworks.com/">Wrangle Works!</a> |
['https://www.wrangleworks.com/'] |
| Parameter | Required | Data Type | Notes |
|---|---|---|---|
| input | ✓ | str, list | |
| output | str, list | ||
| data_type | ✓ | text / links | The type of data to extract |
| where | str | Filter the data to only apply the wrangle to certain rows using an equivalent to a SQL where criteria, such as column1 = 123 OR column2 = 'abc' | |
| output_format | string | Format of the extract output Allowed values: list, columns, concatenate. |
|
| char | string | Character to use when output_format is concatenate | |
| where_params | str | Variables to use in conjunctions with where. This allows the query to be parameterized. This uses sqlite syntax (? or :name) | |
| if | str | A condition that will determine whether the action runs or not as a whole. |
Extract categorical properties from unstructured text such as colours or materials.
wrangles:
- extract.properties:
input: water bottles
output: properties
| Products | Product Properties |
|---|---|
| Stainless Steel Blue Bottle | {'Colours': ['Blue'], 'Materials': ['Stainless Steel']} |
| Plastic Yellow Bottle | {'Colours': ['Yellow'], 'Materials': ['Plastic']} |
wrangles:
- extract.properties:
input: water bottles
output: properties
property_type: colours # Optional
| Products | Product Colours |
|---|---|
| Stainless Steel Blue Bottle | ['Blue'] |
| Plastic Yellow Bottle | ['Yellow'] |
| Parameter | Required | Data Type | Notes |
|---|---|---|---|
| input | ✓ | str, list | |
| output | ✓ | str, list | |
| property_type | str | The specific type of properties to extract (Colours, Materials, Shapes, Standards). Defaults to None, which will return all properties. | |
| return_data_type | str | The format to return the data (list or string), defaults to list | |
| first_element | bool | Get the first element from results, defaults to False. | |
| where | str | Filter the data to only apply the wrangle to certain rows using an equivalent to a SQL where criteria, such as column1 = 123 OR column2 = 'abc' | |
| output_format | string | Format of the extract output Allowed values: list, dictionary, columns, concatenate. |
|
| char | string | Character to use when output_format is concatenate | |
| where_params | str | Variables to use in conjunctions with where. This allows the query to be parameterized. This uses sqlite syntax (? or :name) | |
| if | str | A condition that will determine whether the action runs or not as a whole. |
Extract single values using regex
wrangles:
- extract.regex:
input: Product
output: GPM
find: \d\.?\d? ?gpm
| Product | GPM |
|---|---|
| 3.4 gpm water pump | 3.4 gpm |
| 2gpm water pump | 2gpm |
The output_pattern parameter can be used to specify regex capture groups to output
wrangles:
- extract.regex:
input: Product
output: GPM
find: (\d\.?\d?) ?gpm
output_pattern: \1 Gallons Per Minute
| Product | GPM |
|---|---|
| 3.4 gpm water pump for 5.5 gallon tank | 3.4 Gallons Per Minute |
| 2gpm water pump for 2 gal tank | 2 Gallons Per Minute |
| Parameter | Required | Data Type | Notes |
|---|---|---|---|
| input | ✓ | str | |
| output | ✓ | str | |
| find | ✓ | str | Pattern to find using regex |
| output_pattern | str | Specifies the format to output matches and specific capture groups using backreferences (e.g., \1, \2). Default is to return entire matches. |
|
| first_element | bool | Get the first element from results, defaults to False. | |
| where | str | Filter the data to only apply the wrangle to certain rows using an equivalent to a SQL where criteria, such as column1 = 123 OR column2 = 'abc' | |
| output_format | string | Format of the extract output Allowed values: list, columns, concatenate. |
|
| char | string | Character to use when output_format is concatenate | |
| where_params | str | Variables to use in conjunctions with where. This allows the query to be parameterized. This uses sqlite syntax (? or :name) | |
| if | str | A condition that will determine whether the action runs or not as a whole. |