Calculate row count of a specific column, or pivot table

I’m looking to find the count of rows generated by the pivot table generated.
Row count of a specific column would also suffice.

Try using the PivotTable.DataRange, for instance:

pivotTable.PivotCache.Refresh();
pivotTable.Calculate();

var pivotData = pivotTable.DataRange;
for (int r = 0; r < pivotData.Height; r++)
{
    for (int c = 0; c < pivotData.Width; c++)
        Console.Write(pivotData[r, c].Value + " | ");
    Console.WriteLine();
}

I hope this helps.

Regards,
Mario

Thank you Mario,

It seems that DataRange is not recgonized as a property of my pivot table.

We are currently using version 49.0.1067 and referencing library GemBox.Spreadsheet.PivotTables

This API was added in version 49.0.1202:

1 Like