We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PivotTable RefreshData throws ‘The PivotTable field name is invalid’ exception Aspose.Cells Product Family

The code below throws Aspose.Cells.CellsException : “The PivotTable field name is invalid”.

var workbook = new Workbook(“test.xls”);
var pivot = workbook.Worksheets[1].PivotTables[0];
pivot.RefreshData();

Aspose.Cells.dll version 22.1.0

The tests files are attached.

Rapport (11) (1).zip (39.9 KB)

@vlemadre,

I have used both your files in your provided zipped archive using the following sample code, it works fine and I do not get this exception. I got an exception “this data source is not supported” for the pivot table in the first worksheet for the second file. The exception is inevitable because currently Aspose.Cells does not support to refresh pivot table whose data source is external. Other than this, every thing is ok and I do not get exception for other Pivot tables:
e.g.
Sample code:

var workbook = new Workbook("e:\\test2\\Rapport (11) (1).xlsx");
var pivot = workbook.Worksheets[0].PivotTables[0];
pivot.RefreshData();

var workbook1 = new Workbook("e:\\test2\\Rapport (11) plage.xlsx");
var pivot1 = workbook1.Worksheets[0].PivotTables[0];
//pivot1.RefreshData();//exception: this data source is not supported --> Aspose.Cells does not support to refresh Pivot table whose data source is external

var pivot2 = workbook1.Worksheets[1].PivotTables[0];
pivot2.RefreshData();

Please make sure you have provided the correct files. Also, make sure you are using latest version of the APIs. If you still find the issue with your provided files, let us know with complete sample code (runnable) to reproduce the issue on our end, we will check it soon.