I've done something similar to this before, but I didn't do it using C#. I used VBA since the language is already built in to Excel.
My approach was this:
- Create a worksheet called "RAW DATA." This worksheet has a QueryTable object in it that can be updated via code in VBA.
- I manually created a pivot table based on the QueryTable in the RAW DATA worksheet.
- I then added code in VBA so that after RAW DATA was updated, Pivot Table was refreshed with the new data.
This method works really well if the layout of your raw data and your pivot table stays the same. I have a workbook that I made for a cowork that updates multiple sheets with pivot tables based on one set of data. She really likes it because just by clicking one button, she has a refreshed view of all of her data.
If this approach works for you and you'd like more details as to how to implement some of those methods, let me know more details of your situation and I can try to help you out.