I have a sheet that I update in C#. There is a pivot table using this sheet which needs to be refreshed. I am trying to refresh this Pivot table using VS 2015 and C#. I am doing the below and it doesn't seem to refresh the Pivot table. I am able to confirm this, by dragging the field which I updated in the sheet and the data is old data.
Excel.PivotTable pvtTable = (Excel.PivotTable)excelSheets.PivotTables("Actives");
pvtTable.RefreshTable();
I also tried using Pivotcache by the below code and that didn't work either.
excelSheets.PivotTables("Actives").PivotCache.Refresh();
Any insight would be very appreciated.Thanks!