transpose

Swap the positions of rows and columns in a data extract.

This guide explains how to configure the transpose instruction. To learn about another instruction, go back to the Available custom script instructions overview.

Introduction

Use the transpose instruction to swap the positions of rows and columns in a data extract. The values in the rows of the first column are used to name the transposed columns.

Creating a custom script transformation using the transpose instruction

To create and configure a custom script using the transpose instruction, follow these steps:

  1. Create a custom script transformation.

  2. In the Instructions step, select the transpose instruction.

  3. To configure the custom script instruction, fill in the following fields. Required fields are marked with an asterisk (*).

Row limit*

Enter the number of rows to be transposed. All rows after this limit are removed from the data extract.

Subtable

Enter the name for a subtable that you want to use within this custom script.

A subtable is a temporary table that only exists for this custom script. You can apply additional instructions within the same custom script to the subtable. However, the subtable cannot be used in any other custom scripts.

If a subtable does not exist for the current custom script, the transformation is applied to the data extract, and the enriched data is output into the subtable. If the subtable already exists for the custom script, the subtable is used as the input for the transformation and optionally as the output.

Example

Transformation configuration

Row limit*

3

Data table before transformation

Ad Group

Region

Clicks

media

UK

3493

ecommerce

UK

8891

media|social

France

2782

social

Germany

7397

outreach

USA

6397

Data table after transformation

Ad Group

media

ecommerce

media|social

Region

UK

UK

France

Clicks

3493

8891

2782