Please provide us a console application(runnable) along with the template and output file as well. Identify and describe the issue in detail using some snapshots etc. Also provide us an expected output file which is created by Excel. It will help us to compare the output created by Aspose.Cells with the expected output file and provide our feedback.
We were able to observe the issue but at different place with the latest version Aspose.Cells for .NET 18.9.x. We need to look into it more therefore we have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.
Note that we have mentioned your original issue as well in the logged ticket.
This issue has been logged as
CELLSNET-46379 - Exception NullReferenceException raised while calling Worksheet.PivotTables.Add
We have investigated your issue and found it is not an issue with the APIs. While creating PivotTable, if the worksheet name contains special chars, you need to surround the worksheet name with single quotes. So you should change the following code:
i.e., string datasource = sheetname + "!A3:" + columnName + row_last.ToString();
to: string datasource = "'" + sheetname + "'" + "!A3:" + columnName + row_last.ToString();