Documents for Excel, Java Edition | How to Add a Pivot Table to a Spreadsheet

GrapeCity Documents for Excel, Java Edition, (GcExcel Java) is a high-speed, feature-rich Excel document API based on VSTO. We released the GcExcel for .NET Version in April 2018, and with this launch, it's now possible to use a similar package in Java applications.

In this video, we’ll add a pivot table to a spreadsheet.

Here is data that displays revenue from selling produce in different countries. This data is not arranged country-wise, and the types of produce varies in order.

We’ll want to gather the total amount earned from the types of produce and filter it country-wise. We’ll use a Pivot table for this with GcExcel.

Step 1:

To create a pivot table in GcExcel, initialize the workbook.

Step 2:

Add data and assign it to a range in the worksheet.

Step 3:

Add a Pivot Table and assign the range of data.

Step 4:

Set the location of Pivot Table.

Step 5:

Let’s set up the Pivot Table fields. Assign the respective Pivot Table fields to the worksheet columns.

Step 6:

We’ll need to calculate total amount of money earned row-wise, so your Row Field will be a Category.

Step 7:

We’ll need the figures for each Product in the Category. Set the 'Column Field' to the Product.

Step 8:

We’ll want the total on the amount, so set the 'Data Field' to 'Amount.'

Step 9:

If you want to see the totals, country-wise, set the Page Field of the Pivot Table to 'Country'.

Step 10:

Save the workbook and see the result. We can see the Pivot table displays the exact results required.

With GcExcel, you can command total control of your spreadsheets—with no dependencies on Excel.

If you have a comment or question about this tutorial, please leave your comments in the thread below.

Custom Code Your Spreadsheets in Java

Download the latest version of GrapeCity Documents for Excel, Java Edition

Download Now!