Here is the code that deals with the pivot. Unfortunately I cannot provide much more than this due to privacy rules. The pivot is being created and is what I want except for the Value (DATA) is a sum not count, and it is not sorting anything. There are no compilation errors or exceptions being generated.
NOTE: str is the filepath
Workbook workbook = new Workbook(str);
int sheetIndex = workbook.getWorksheets().add();
Worksheet sheet2 = workbook.getWorksheets().get(sheetIndex);
sheet2.setName("Pivot");
PivotTableCollection pivotTables = sheet2.getPivotTables();
String range = "=Sheet1!A1:W25000";
int index = pivotTables.add(range, "A1", "Pivot");
PivotTable pivotTable = pivotTables.get(index);
pivotTable.setRowGrand(true);
pivotTable.setColumnGrand(true);
pivotTable.setAutoFormat(true);
pivotTable.setAutoFormatType(PivotTableAutoFormatType.REPORT_6);
pivotTable.addFieldToArea(PivotFieldType.ROW,13);
pivotTable.addFieldToArea(PivotFieldType.PAGE,3);
pivotTable.addFieldToArea(PivotFieldType.PAGE,19);
pivotTable.addFieldToArea(PivotFieldType.PAGE,10);
pivotTable.addFieldToArea(PivotFieldType.COLUMN,12);
pivotTable.addFieldToArea(PivotFieldType.DATA,13);
pivotTable.getDataFields().get(0).setNumber(0);
//These lines are not doing anything to the pivot
pivotTable.getDataFields().get(0).setSubtotals(PivotFieldSubtotalType.COUNT, true);
pivotTable.getDataFields().get(0).setAutoSort(true);
workbook.save(str)