# CSV unpivot

- Human page: https://happytails.ai/en/data-tools/csv-unpivot/
- Markdown: https://happytails.ai/en/data-tools/csv-unpivot.md
- Structured JSON: https://happytails.ai/agents/en/data-tools/csv-unpivot/index.json
- Visibility: public

## Tool capabilities

| Property | Value |
| --- | --- |
| Tool ID | `csv-unpivot` |
| Category | data-tools |
| Implementation | Registered implementation. Registration alone is not a production-quality guarantee. |
| Browser execution | Automatic updates after valid input or file selection. |
| Browser processing | Browser; see tool notes for network behavior. |
| HTTP API | Not callable through HTTP. |
| Browser-agent interface | run_current_tool |

### Implementation notes

Turn selected measure columns into variable/value records. Identifier columns and cell strings are preserved. Results follow source-record order, then your selected column order. Use a header row with unique column names. Up to 1,000,000 input characters, 10,000 data records, 100 columns and 100,000 cells. Strings and spaces are preserved. Output CSV uses commas and quotes every cell. Protect formulas prefixes risky output cells with an apostrophe; choose Preserve original cells only for trusted machine processing. Runs on your device.

### Inputs and settings

Text input: CSV.

Example or placeholder shown in the interface (not a validated fixture):

```text
name,score
Ada,98
Sam,92
```

Include a header row. Quote cells that contain commas or new lines. Results update as you type. Up to 1,000,000 characters.

| Setting | Meaning | Control type | Default | Constraints |
| --- | --- | --- | --- | --- |
| `delimiter` | Input CSV separator | select | "," | Allowed: ,, ;, 	 |
| `columns` | Measure columns | text | "Jan,Feb" |  |
| `variableColumn` | New variable column | text | "variable" |  |
| `valueColumn` | New value column | text | "value" |  |
| `dropEmpty` | Omit empty measure cells | checkbox | false |  |
| `exportMode` | Spreadsheet formula handling | select | "Protect formulas" | Allowed: Protect formulas, Preserve original cells |

### Browser-agent workflow

1. Open the human page in a browser that supports WebMCP.
2. Discover the interface exposed by that page; use its actual schema.
3. Select files on the page first when the tool requires files.
4. Call `run_current_tool` with valid input and settings.
5. Inspect the returned result or error and the displayed output. Retrieve files from the displayed download links.

Calls do not automatically copy or download results. Browser permissions still apply. Interface availability alone is not proof of successful execution.

### Planning specification

List the measure columns to unpivot, such as Jan,Feb. Each selected cell becomes a record containing the original identifier fields, the measure's column name and its value. Every unselected column remains an identifier. Results follow source-record order and then your selected measure-column order. Empty values are retained by default. Omit empty measure cells if you do not need those records; zero and spaces are still preserved. You can name the new variable and value columns. Their names must be distinct and must not overwrite a retained column. Quote a measure-column name containing a comma. Review the table, then download the complete CSV and JSON processing report. Values remain strings rather than being converted to numbers or dates. The default export prefixes formula-like cells with an apostrophe. Use original-string export for trusted machine processing and import CSV columns as text when exact identifiers matter.

This describes intended requirements. Use the implementation notes, interface schema and observed output to determine current support.

### Complete machine-readable capability record

```json
{
  "id": "csv-unpivot",
  "category": "data-tools",
  "built": true,
  "requirements": "List the measure columns to unpivot, such as Jan,Feb. Each selected cell becomes a record containing the original identifier fields, the measure's column name and its value. Every unselected column remains an identifier. Results follow source-record order and then your selected measure-column order. Empty values are retained by default. Omit empty measure cells if you do not need those records; zero and spaces are still preserved. You can name the new variable and value columns. Their names must be distinct and must not overwrite a retained column. Quote a measure-column name containing a comma. Review the table, then download the complete CSV and JSON processing report. Values remain strings rather than being converted to numbers or dates. The default export prefixes formula-like cells with an apostrophe. Use original-string export for trusted machine processing and import CSV columns as text when exact identifiers matter.",
  "implementation": {
    "fields": [
      {
        "key": "delimiter",
        "label": "Input CSV separator",
        "value": ",",
        "type": "select",
        "values": [
          ",",
          ";",
          "\t"
        ]
      },
      {
        "key": "columns",
        "label": "Measure columns",
        "value": "Jan,Feb",
        "type": "text",
        "help": "One comma-separated CSV record of exact column names. Quote a name that contains a comma. All unselected columns remain identifiers."
      },
      {
        "key": "variableColumn",
        "label": "New variable column",
        "value": "variable",
        "type": "text"
      },
      {
        "key": "valueColumn",
        "label": "New value column",
        "value": "value",
        "type": "text"
      },
      {
        "key": "dropEmpty",
        "label": "Omit empty measure cells",
        "value": false,
        "type": "checkbox"
      },
      {
        "key": "exportMode",
        "label": "Spreadsheet formula handling",
        "value": "Protect formulas",
        "type": "select",
        "values": [
          "Protect formulas",
          "Preserve original cells"
        ]
      }
    ],
    "live": true,
    "presentation": "metrics",
    "note": "Turn selected measure columns into variable/value records. Identifier columns and cell strings are preserved. Results follow source-record order, then your selected column order. Use a header row with unique column names. Up to 1,000,000 input characters, 10,000 data records, 100 columns and 100,000 cells. Strings and spaces are preserved. Output CSV uses commas and quotes every cell. Protect formulas prefixes risky output cells with an apostrophe; choose Preserve original cells only for trusted machine processing. Runs on your device.",
    "experience": {
      "automatic": true,
      "single": false,
      "inputMaxLength": 1000000,
      "inputMode": "text",
      "label": "CSV",
      "placeholder": "name,score\nAda,98\nSam,92",
      "help": "Include a header row. Quote cells that contain commas or new lines. Results update as you type. Up to 1,000,000 characters.",
      "action": null
    },
    "mode": "automatic",
    "interactive": false
  },
  "execution": "Browser interface",
  "api": null,
  "browser_agent": {
    "supported": true,
    "name": "run_current_tool",
    "discovery": "WebMCP on the human page in a supporting browser",
    "verification": "See audit/API-AUDIT.md; availability is not verification"
  }
}
```

## Page guide

Convert a wide CSV into tidy long-form records. Turn measure columns into a variable and value while keeping identifiers.

How can we improve this tool?

Report a problem or share an idea.

Please leave out private information. Your message and the tool name go to our team via PostHog.

### How to use CSV unpivot

1. Paste the wide CSV and choose its input separator.
2. List the exact measure-column names and choose the two new column names.
3. Review the long-form records and download the CSV.

## Useful next steps

- [CSV pivot](https://happytails.ai/en/spreadsheet-tools/csv-pivot/) ([Markdown](https://happytails.ai/en/spreadsheet-tools/csv-pivot.md))

- [CSV row filter](https://happytails.ai/en/data-tools/csv-row-filter/) ([Markdown](https://happytails.ai/en/data-tools/csv-row-filter.md))

- [CSV cell expansion](https://happytails.ai/en/data-tools/csv-cell-expansion/) ([Markdown](https://happytails.ai/en/data-tools/csv-cell-expansion.md))

- [Dataset value mapper](https://happytails.ai/en/data-tools/dataset-value-mapper/) ([Markdown](https://happytails.ai/en/data-tools/dataset-value-mapper.md))

## What to expect

Convert a wide CSV into tidy long-form records. Turn measure columns into a variable and value while keeping identifiers. List the measure columns to unpivot, such as Jan,Feb. Each selected cell becomes a record containing the original identifier fields, the measure's column name and its value. Every unselected column remains an identifier. Results follow source-record order and then your selected measure-column order. Empty values are retained by default. Omit empty measure cells if you do not need those records; zero and spaces are still preserved. You can name the new variable and value columns. Their names must be distinct and must not overwrite a retained column. Quote a measure-column name containing a comma. Review the table, then download the complete CSV and JSON processing report. Values remain strings rather than being converted to numbers or dates. The default export prefixes formula-like cells with an apostrophe. Use original-string export for trusted machine processing and import CSV columns as text when exact identifiers matter.

### Try a small example

```
id,Jan,Feb
001,2,3
002,0,
```
