I need to set the source data of a Pivot Table in vb .net.
Can I use a DataTable to do it?
Code:DT As DataTable
...
xlApp = New Excel.Application
xlWorkBook = xlApp.Workbooks.Open(sPath)
xlApp.Workbooks(1).PivotCaches(1).SourceData = DT
Printable View
I need to set the source data of a Pivot Table in vb .net.
Can I use a DataTable to do it?
Code:DT As DataTable
...
xlApp = New Excel.Application
xlWorkBook = xlApp.Workbooks.Open(sPath)
xlApp.Workbooks(1).PivotCaches(1).SourceData = DT
The DataSource property might be better set with an Array from .net
Quote:
External data source - An array. Each row consists of an SQL connection string with the remaining elements as the query string, broken down into 255-character segments.