Free plan

Reshape

Turn a table around: columns to rows, rows to columns, or a pivot
POST
/v1/data/reshape

About this tool

This tool changes the shape of a table. It can unpivot a wide table, where each month is a column, into a long one with a row per month. It can do the reverse, pivoting a long table into a wide one and adding up or averaging the numbers. Or it can swap rows and columns.
For example, you turn one column per month into one row per month.

How to use it

  1. Choose this tool.
  2. Add your table with Upload or drag and drop.
  3. Choose what to do: unpivot, pivot or swap rows and columns.
  4. Pick the columns to keep and the columns to turn, then press Generate.
  5. Download the reshaped table.

What you get back

You get a new table with the new shape. Download it.
GOOD TO KNOW
A pivot may make at most 5000 columns, an unpivot at most 20 million cells. sum, mean, min, max and median need numbers. Counts as one conversion.
TEST IT LIVE

Try Reshape in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
Data
Plan
Free
Method
POST
Endpoint
/v1/data/reshape
Tool ID
data.reshape
Authentication
API key
Accepts
Text and settings
Background jobs
Yes
Usage group
Data
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/data/reshape" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'file=@document.pdf' \
  -F 'operation=unpivot' \
  -F 'id_columns=["id","region"]' \
  -F 'value_columns=["jan","feb"]'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.data.reshape({
    "file": 'document.pdf',
    "operation": "unpivot",
    "id_columns": "[\"id\",\"region\"]",
    "value_columns": "[\"jan\",\"feb\"]"
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->data()->reshape([
    'file' => 'document.pdf',
    'operation' => 'unpivot',
    'id_columns' => '["id","region"]',
    'value_columns' => '["jan","feb"]',
]);
echo $result->requestId;
FAQ

Frequently asked questions

Turn a table around: unpivot a wide table into a long one, pivot a long table into a wide one (summing, averaging, counting …), or transpose rows and columns.

Reshape works from text and settings, so no file is needed. Every input is optional.

Reshape is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/data/reshape with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.