Pivot Filter with Golang via C++
Possible Usage Scenarios
When you create a pivot table with known data and want to filter the pivot table, you need to learn how to use filters. It can help you effectively filter the data you want. By using the Aspose.Cells API, you can add and clear filters on field values in Pivot Tables.
Add Filter in Pivot Table in Excel
To add a filter in a Pivot Table in Excel, follow these steps:
- Select the PivotTable that you want to add a filter to.
- Click on the drop‑down arrow for the filter you want to add in the pivot table.
- Select “Top 10” from the drop‑down menu.

- Set the show mode and the number of filters.

Add Filter in Pivot Table
Please see the following sample code. It sets the data and creates a PivotTable based on it. Then it adds a filter on the row field of the pivot table. Finally, it saves the workbook in output XLSX format. After executing the example code, a pivot table with a Top 10 filter is added to the worksheet.
Sample Code
Clear Filter in Pivot Table in Excel
To clear a filter in a Pivot Table in Excel, follow these steps:
- Select the PivotTable that you want to clear the filter from.
- Click on the drop‑down arrow for the filter you want to clear in the pivot table.
- Select “Clear Filter” from the drop‑down menu.

- If you want to clear all filters from the pivot table, you can also click on the “Clear Filters” button in the PivotTable Analyze tab on the ribbon in Excel.

Clear Filter in Pivot Table
Clear a filter in a Pivot Table using Aspose.Cells. Please see the following sample code.
- Set the data and create a PivotTable based on it.
- Add a filter on the row field of the pivot table.
- Save the workbook in output XLSX format. After executing the example code, a pivot table with a Top 10 filter is added to the worksheet.
- Clear the filter on a specific pivot field. After executing the code to clear the filter, the filter on the specific pivot field will be cleared. Please check the output XLSX.