...
Before writing any PivotTable code, make sure to open the workbook with ExcelApplication
and get references to the data worksheet and a worksheet for the PivotTable. See Adding OfficeWriter to your .NET Application.
Code Block |
---|
ExcelApplication xla = new ExcelApplication(); //Example.xlsx has a worksheet 'Data' with 9 columns and 244 rows of data Workbook wb = xla.Open("\\Example.xlsx"); Worksheet data_ws = wb.Worksheets["Data"]; Worksheet pivot_ws = wb.Worksheets.CreateWorksheet("Pivot"); |
...