Intro

Add Excel's grouping and outlining functionality to a workbook with ExcelWriter to display nested data.

Choose a year from the dropdown list below.  This is a SQL parameter that retrieves order data from the AdventureWorks database for a particular year.  The sales data is written into the worksheet and grouped by major product category.  Subtotal lines are written after each major product category.  Each group of product sales line items is also grouped into a collapsible outline.

If you need to display nested, subtotaled data in your Excel report, this demo will be particularly useful to you.

Code

Insert code from sample stored in SVN here

Downloads

Data: GroupingComponents.csvGroupingBikes.csvGroupingClothing.csvGroupingAccessories.csv

Template: GroupingAndNestingTemplate.xlsx

Output: GroupingSubtotals_output.xlsx