Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
ExcelApplication xla = new ExcelApplication();

//Example.xlsx has a worksheet 'Data' with 9 columns and 244 rows of data
Workbook wb = xla.Open("\\BasicExample.xlsx");

Worksheet data_ws = wb.Worksheets["Data"];
Worksheet pivot_ws = wb.Worksheets.CreateWorksheet("Pivot");
Note

Excel does not encourage placing more than one PivotTable on a worksheet because PivotTables are not allowed to overlap. ExcelWriter cannot render PivotTables, so it This example places the PivotTable on a separate sheet. It is recommended that each PivotTable be placed on a separate sheet.

This is because Excel does not allow PivotTables to overlap. When building PivotTables in Excel, an error message will be thrown if performing an action would cause two PivotTables to overlap. ExcelWriter does not have the ability to render PivotTables so it cannot calculate which cells the a PivotTable occupies and . Therefore, it cannot detect when PivotTables might overlap and will not throw an exception even if the code generates overlapping PivotTables.

To avoid this, we encourage you to keep your PivotTables on separate worksheets.

...

There are 9 columns and 244 rows in the data set, including the row with the header values.

...