# Create Pivot Table

> `UiPath.Excel.Activities.Business.CreatePivotTableX`

`UiPath.Excel.Activities.Business.CreatePivotTableX`

Creates a pivot table from a specified 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. The activity can be used 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.

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

## Configuring the activity

#### In the body of the activity

* **Source range** - Select **Plus** on the right side of the field and then, from the menu, select the Excel file and then select a named range, table, or sheet from the file, or select **Indicate in Excel** to indicate a range directly from the file. Alternatively, you can select **Open in Advanced Editor** to enter a VB expression.
* **New table name** - Select **Plus** on the right side of the field and then, from the menu, select **Text** to enter a name for the table in the Text Builder. If a pivot table with the same name already exists at the destination, the table is deleted and recreated.

  Alternatively, you can use one of the available options in the menu to indicate the name:
  + Data from the Project Notebook, a parent Excel file or Outlook account. For example, select a cell in an Excel file, or a field in a selected Outlook email.
  + **Use Saved Value** - Select a value that you previously saved for later use in the project.
  + **Ask when run** - Prompt for a name when the project is executed.
  + **Open in Advanced Editor** - Enter a VB expression.
* **Destination range** - Select **Plus** on the right side of the field and then, from the menu, select an Excel file and then a table or sheet where to create the pivot table, or select **Indicate in Excel** to indicate directly from the file. Alternatively, you can select **Custom Input** to enter the range manually, or **Open in Advanced Editor** to enter a VB expression.
* **Add Pivot Table Field** - Select this button to add a pivot table field.

**Pivot Field Options**

* **Field** - Select **Plus** on the right side of the field and then, from the menu, select **Range** and a column header, or select the Excel file and then **Indicate in Excel** to indicate a column header in the file. Alternatively, you can select one of the other options in the menu to indicate the column header:

  + **Use Saved Value** - Select a value that you previously saved for later use in the project.
  + **Text** - Enter the text in the column header using the Text Builder.
  + **Ask when run** - Prompt for the text in the column header when the project is executed.
  + **Open in Advanced Editor** - Enter a VB expression.
* **Is a** - Select what the field should be in the pivot table: Row, Column, Filter, or Value.
* **Function** - If the field is a value, select what function should be used: Sum, Count, Average, Max, Min, Product, CountNumbers, StdDev, StdDevp, Var, or Varp.

#### Properties panel

**Common**

* **DisplayName** - The name displayed for the activity in the Designer panel.

**Input**

* **Destination range** - See **Destination range** in the body of the activity.
* **Layout** - Enhances the pivot table layout and format. The **compact** form optimizes for readability while the **tabular** and **outline** forms include file headers. The default value is **compact**.
* **New table Name** - See **New table name** in the body of the activity.
* **Table range** - See **Source range** in the body of the activity.
* **Values added as** - Select how to add the values in the pivot table, either as columns (the default option) or rows.

**Misc**

* **Private** - If selected, the values of variables and arguments are no longer logged at Verbose level.
