> For the complete documentation index, see [llms.txt](https://docs.rasgoml.com/rasgo-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rasgoml.com/rasgo-docs/rasgo-0.1/all-transforms/vlookup.md).

# Vlookup

## Inspired by Excel... a VLookup experience that works in SQL

### Required Inputs

* Lookup Column: The column to look up in the Lookup Table. Make sure the column is named the same in both tables.
* Lookup Table: The table to look up the Lookup Column in.

### Optional Inputs

* Keep Columns: The columns to keep from the Lookup Table. If not provided, all columns from the Lookup Table will be kept.

### Notes

* For values that don't find a match in the lookup\_column, you will see Null
* For columns that have the same name in both tables, the columns in the Lookup Table will be prefixed with the table name

## Parameters

| Name           | Type         | Description                            | Is Optional |
| -------------- | ------------ | -------------------------------------- | ----------- |
| lookup\_column | column       | Column to look up in the lookup table  |             |
| lookup\_table  | table        | Table to look up the lookup\_column in |             |
| keep\_columns  | column\_list | Columns to keep from the lookup table  | True        |

## Example

```python
internet_sales = rasgo.get.dataset(74)
customer = rasgo.get.dataset(55)
product = rasgo.get.dataset(75)

ds2 = internet_sales.vlookup(
  lookup_column='PRODUCTKEY',
  lookup_table=product.fqtn,
  keep_columns=['WEIGHT', 'ENGLISHDESCRIPTION']
)
ds2.preview()
```

## Source Code

{% embed url="<https://github.com/rasgointelligence/RasgoTransforms/blob/main/rasgotransforms/rasgotransforms/transforms/vlookup/vlookup.sql>" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.rasgoml.com/rasgo-docs/rasgo-0.1/all-transforms/vlookup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
