How to export xlsx with pivot table in .NET

Hi, I’ve never used Aspose.
I have to create a simple webpage using C# that takes data from some external APIs, create an xlsx with two sheets: the first one with a simple table with data, the second one with a pivot table who takes data from the first one. I already have an xlsx with this structure.
Is it possible to take the pivot structure/settings from this file and use it in the C# code? Or I can save just the source sheet and each time I have to re-create all the structure on my exported file?
How can I do that?

@ilrenzo,

Thanks for your query.

If your source data (for PivotTable) range is same but different contents, you may simply open the template file (having data in the first sheet and PivotTable in the second sheet) and just change the source data in the first sheet (by importing/filling data from some source) accordingly, the PivotTable in the second sheet can be generated accordingly based on the updated source data in the first sheet to save as the file. Please see the topic with example code for your complete reference:

Hope, this helps a bit.

1 Like