Ii have an urgent problem and I am thankful for any help.
I do a query based on user-selected parameters and generate a data set. This data set is dumped into an Excel sheet.
Now, I want to take that data set and pivot it to create another table and populate into a second sheet in that Excel file.
I wrote a query for that pivot and that works.
How should I proceed?
1. Should I use the first data set and give this as a parameter to the pivot query? And have it return a data table that I can dump into Excel? How do I do this? Are there other solutions?
The Excel file is created using OpenXML and I do not know how to create a pivot table directly from first sheet into a second jsheet.
1. Should I use the first data set and give this as a parameter to the pivot query? And have it return a data table that I can dump into Excel? How do I do this? Are there other solutions?
Here original datatable passed as a parameter and it return pivoted datatable
Now, I want to take that data set and pivot it to create another table and populate into a second sheet in that Excel file.
Hi,
You could read the data from the first sheet into a temp table ,use pivot query to update your data and then insert into the second sheet with OpenXML.
Thanks.
Please mark the replies as answers if they help or unmark if not.
Feedback to us
tinausa
Member
8 Points
27 Posts
Using a data set to pivot into another table
Aug 12, 2012 07:51 PM|LINK
Ii have an urgent problem and I am thankful for any help.
I do a query based on user-selected parameters and generate a data set. This data set is dumped into an Excel sheet.
Now, I want to take that data set and pivot it to create another table and populate into a second sheet in that Excel file.
I wrote a query for that pivot and that works.
How should I proceed?
1. Should I use the first data set and give this as a parameter to the pivot query? And have it return a data table that I can dump into Excel? How do I do this? Are there other solutions?
The Excel file is created using OpenXML and I do not know how to create a pivot table directly from first sheet into a second jsheet.
Thanks again,
Tina
shivv
Participant
1566 Points
283 Posts
Re: Using a data set to pivot into another table
Aug 13, 2012 06:50 AM|LINK
Hi
Here original datatable passed as a parameter and it return pivoted datatable
http://www.codeproject.com/Articles/22008/C-Pivot-Table
http://www.codeproject.com/Articles/46486/Pivoting-DataTable-Simplified
check this.
http://www.codeproject.com/Articles/20228/Using-C-to-Create-an-Excel-Document
Chen Yu - MS...
All-Star
21600 Points
2493 Posts
Microsoft
Re: Using a data set to pivot into another table
Aug 17, 2012 10:05 AM|LINK
Hi,
You could read the data from the first sheet into a temp table ,use pivot query to update your data and then insert into the second sheet with OpenXML.
Thanks.
Feedback to us
Develop and promote your apps in Windows Store