# Create Pivot Table Workbook

> `UiPath.Excel.Activities.Business.CreatePivotTable`

`UiPath.Excel.Activities.Business.CreatePivotTable`

Creates a pivot table from a specified workbook range or table to help you calculate, summarize, and analyze data. Once added, you can add pivot table fields as rows, columns, filters, or summary fields. You can use the activity with an Excel file selected for a parent [Use Excel File](https://docs.uipath.com/activities/other/latest/productivity/excel-application-card) activity or with the Project Notebook.

:::note
The supported Workbook formats are `.xls`, `.xlsm`, `.xltm`, `.xlsx`, and `.xltx`.
:::

To learn how to use this activity, check [Tutorial: Creating a Pivot Table](https://docs.uipath.com/studiox/docs/tutorial-creating-a-pivot-table).

## Project compatibility

Windows | Cross-platform

## Configuration

* **File (local path)** - The full local path of the workbook. To switch to file resource, select the plus icon, and then **Use a File Resource**. The current field will change to **File**, where you can provide the full path of the resource workbook.
* **Use table source** - This option is disabled by default. When you enable it, it replaces the **Source sheet** and **Source range** fields with **Source table name**.
* **Source table name** - The name of the source table for the pivot.
* **Source sheet** - The source sheet for the pivot table.
* **Source range** - The source range for the pivot table. If not specified, the entire sheet is used.
* **Pivot sheet name** - The sheet where to place the pivot table. If the sheet does not exist, it is created.
* **Pivot placement cell** - The top-left cell of the pivot table, including filters. It defaults to `A1`.
* **Pivot table name** - The name of the pivot table.
* **Pivot table fields**- The fields of the pivot table.

## Properties

Input

* **Layout** - Enhances the pivot table layout and format. You can choose between the following options:
  + **Compact** - This form optimizes for readability.
  + **Tabular** - This form includes file headers.
  + **Outline** - This form includes file headers. The default value is **Compact**.
* **Values added as** - Select how to add the values in the pivot table, either as **Columns** or **Rows**. The default option is **Columns**.

Options

* **Password** - Optionally, enter the password of the workbook.

Use Workbook

* **Workbook** - The existing workbook to use.

## Known limitations

**Limitation 1**

The **Create Pivot Table Workbook** activity does not function correctly when attempting to create a pivot table that already exists in the workbook.

Due to a limitation in the underlying **ClosedXML** library, the following scenarios are not fully supported:

* Removing existing pivot tables.
* Deleting a sheet that contains a pivot table.

Recreating an existing pivot table in the same workbook may lead to corrupted Excel files or runtime errors.

**Workaround**

* If a pivot table with the desired name does not exist, the activity will create it as usual.
* If a pivot table with the desired name exists, and the source data is the same, the activity will update the existing pivot table.
* An exception is thrown if a pivot table with the desired name exists, but the source data differs.

**Limitation 2**

The activity does not support external sources for pivot tables.
