I am writing a plugin using C# which will generate the pivot table from data stored in an CSV file. I try using the PivotTableWizard object but don't know how to specified the value for the parameter SourceData in this case.
As far as I test, we cannot create a PivotTable directly from .csv file, even manually. To use .csv file create PivotTable, we need find a bridge for us.
An approach is, we can configure the ODBC(Data Source) in control panel to add a User DSN with “Driver da Microsoft para arquivos texto”. And set the folder which includes your csv file to be the data base directory.
After the configuration, we can add a connection in Excel. With the new connection to csv file added, you can easily create a pivot table using that connection as SourceData parameter.