I have an .xls where the first 5 sheet have pivot table on them. Now what is currently done manually is that the 6th sheet is populated with data and that data is used by the pivot table on the first 5 sheets. I want to do this programmatically. I took a sample .xls and strip out the data on the 6th sheet and I am using Aspose to populate the sheet. However, how do I assign each pivot table a data source in code.
Here is what I have so far:
templateSheet = xlApp.Worksheets;
templateSheet.Name = UserID;
selectedCells = templateSheet.Cells;
selectedCells.ImportDataTable(DataSource, true, 1, 0);
Range range = templateSheet.Cells.CreateRange(1, 0, DataSource.Rows.Count, DataSource.Columns.Count);
range.Name = “DataRange”;