Skip to main content

Unpivot Table (Melt / Wide to Long)

Convert Excel, CSV, or JSON data from wide to long format with Unpivot/Melt: choose identifiers and value columns, preview the result, and export it.

  • Export
Automate

Embed this widget

Customize the result, check the live preview, then copy the code.

Preview

Embed code type

Code to copy

Responsive and automatically resized by Bethemesh.

Turn a wide table into long format by converting several columns into variable/value pairs.

Your files are processed locally in your browser and are never sent to our servers.

Drop your file here

Recommended size: up to 30 MB

Options

Was this tool useful?

How does this tool work?

Wide tables often place the same kind of measurement in several columns, such as January, February and March. Unpivot turns those columns into rows. Each output row repeats the chosen identifiers and adds a variable name beside its value. This long format is useful for filtering, charting and grouping when a period or measurement type should become a category. The tool rearranges cells without aggregating them; it does not calculate averages, join separate files or transpose the entire table.

Import CSV, TSV, XLSX, XLS or flat tabular JSON. The drop zone allows up to 30 MiB per file, although an expanded result can exceed comfortable browser memory. Workbooks use the first sheet in this interface. Styles and macros are not retained. Enter identifier columns separated by commas. Their values repeat on every output row derived from the same source record. Names must match the imported headings exactly, including case.

Choose the value columns to unfold, also separated by commas. Leaving this field empty selects every non-identifier column. If identifiers are empty too, all columns are unfolded and no identifying context remains. Spaces surrounding entered names are removed and duplicate selections are ignored. Unknown columns, or a column selected as both identifier and value, cause an error. This selector cannot escape a comma within a heading; rename such a column before processing.

Give the generated columns two different names, such as field and value, without overwriting an identifier. The engine visits each source row and then each selected column in order; it does not sort periods. Every selected cell creates a row, including empty or null values. Imported scalar types are retained without forced numeric conversion. CSV and XLSX exports contain the full long table. Columns selected as neither identifiers nor values disappear from that result.

How to use this tool

  1. Keep measurement context

    Select identifiers that explain each cell, such as product, site or person. Ensure that required context is not left in a column excluded from the output.

  2. Choose the unfolded fields

    Enter the intended measurements or deliberately leave the field empty. Name both generated columns clearly and avoid collisions with identifier headings.

  3. Check row multiplication

    Inspect representative records, empty values and period order. Selecting two value columns must create two rows per source record even when one measurement is missing.

Use cases

Turn months into records

Convert a monthly budget into product, month and amount records for period-based analysis.

Reshape questionnaire answers

Turn question columns into question/answer pairs while retaining the respondent identifier and relevant grouping fields.

Prepare another summary

Create long-form records before pivoting across different dimensions, without prematurely aggregating the original measurements.

Examples

Two months per product

Identifier: product; values: January,February; generated columns: month,amount. Two records become four without summing.

Input

product;January;February
A;10;12
B;8;9

Result

product;month;amount
A;January;10
A;February;12
B;January;8
B;February;9

Keep a missing measurement

Identifier: site; value selection empty; generated columns: measurement,value. The empty temperature still creates a row.

Input

site;temperature;humidity
North;;65

Result

site;measurement;value
North;temperature;
North;humidity;65

Tips and best practices

  • Estimate the expanded size before running: twenty selected columns across one hundred thousand records create two million rows. The import limit does not guarantee capacity for that result.
  • Keep units in identifiers or variable names. Combining different measurements in one value column does not make them suitable for addition or comparison without considering their units.
  • Retain the source if you need its exact layout later. A subsequent Pivot may aggregate duplicate identifiers and cannot necessarily recover original cells or ordering.

Frequently asked questions

Is Unpivot the exact inverse of Pivot?

It changes a wide structure into a long one, but cannot restore detail lost in an earlier aggregation. Multiple records with the same identifiers and variable may be summarized by a later Pivot. The round trip is therefore not necessarily identical to the original.

Are empty cells skipped?

No. Each selected value column creates one row per source record, including empty and null cells. This preserves the presence of the variable. Apply an explicit filter afterwards if those measurements should be excluded rather than assuming they disappear.

What does an empty value-column selection mean?

Every column not declared as an identifier is unfolded. That is convenient for monthly series but can also include comments or units accidentally. Inspect the result before exporting so contextual fields are not mistaken for measurements.

How does this differ from Transpose?

Transpose swaps the row/column arrangement and generates row_1, row_2 headings alongside the original field names. Unpivot repeats identifiers and produces variable/value pairs. Choose according to the structure required by your next analysis, rather than appearance alone.

Related tools

Tools similar or complementary to this one.

Similar tools

Cross a row dimension with a column dimension, then calculate count, sum, average, minimum, or maximum.

Data & spreadsheetsFeaturedUse this tool

Swap rows and columns in an Excel, CSV, or JSON table.

Data & spreadsheetsUse this tool

Filter CSV rows by column using text, exact values, or numeric conditions.

Data & spreadsheetsUse this tool
GuideBest practicesBeginner

Split a CSV or Excel table into smaller files

Discover when to split a large table by row count or by a column value, and how to preserve a useful structure in every output file.

29 August 20261 min
GuideBest practicesIntermediate

Build a reproducible data-preparation workflow

Put cleaning, validation, filtering, merging, comparison and conversion in a sensible order, and learn when a reusable pipeline is better than isolated tools.

29 August 20262 min