I would suggest that you use the office interop excel objects to help you accomplish this.
How to create pivot table in excel with C#/VB.NET[
^]
If you need something a little different, then you'd have to look into commercial products that provide that functionality.
A pivot table is not as simple a construct as it may seem on the surface.