Excel: Unpivot columns

Unpivot (melt) wide-format columns into long format on a new sheet.

Help Centre › Building Processes

Unpivot (melt) wide-format columns into long format on a new sheet.

Runs on: macOS and Windows only.

Add it to a process

In the process designer, open the Add step tab. Find Unpivot columns under Excel › Columns, or type its name in the search box, and drag it onto the canvas.

Fields

FieldRequiredWhat it does
File pathNoEnter the file path, or use a variable such as {folders::desktop::path}\file.xlsx. Leave blank to use the workbook an earlier step opened.
SheetYesName of the sheet in the Excel file. Supports wildcards: * matches any characters.
ID columnsYesThe columns to keep on every row (one per line), by heading or column letter. Headings match with spaces trimmed.
Columns to unpivotNoWhich columns to turn into rows: a range such as G:AD, or headings or letters one per line. Leave blank to use every column that is not an ID column.
Columns per itemNoHow many side-by-side columns belong together. Use 2 when each amount column is followed by its invoice-number column. Columns are paired by position, not by name.
Variable column nameNoName for the new column that holds each item's source header, trimmed (default: Variable) Default: Variable.
Value column nameNoName for the new value column (default: Value). With 2 or more columns per item, give one name per column, comma-separated, e.g. Amount, Invoices. Default: Value.
Destination sheetNoName of the new sheet for the unpivoted data. If blank, a default name is used.
Skip empty itemsNoLeave out items whose cells are all blank, or whose amount is 0 with nothing else filled in.
Keep rows with no itemsNoWhen empty items are skipped, still keep one row (ID columns only) for a source row that has no items, so no row disappears unseen.

See all Excel steps.

Example

With ID columns: "Product"

Before (wide format)
ProductJanFebMar
Widget100150200
Gadget8090110

After (long format)
ProductVariableValue
WidgetJan100
WidgetFeb150
WidgetMar200
GadgetJan80
GadgetFeb90
GadgetMar110

Tips

  • This is the reverse of a pivot table – use it to normalise data for databases or reporting tools
  • List all columns that should stay as-is (identifiers) in the ID columns field – everything else gets melted
  • Common use case: converting monthly columns (Jan, Feb, Mar…) into rows with a Month column

Related functions

Get started

See it working on your own data

Everything documented here ships with the platform – try the document tools free, or have your first automation working in 7 days.