Note |
---|
The instructions on this page apply for using pivot tables PivotTables with *ExcelWriter 7.6 and above*. If you are using ExcelWriter 7.5 or earlier please use the instructions on Templates and Pivot Tables in Older Versions |
Excerpt |
---|
A |
...
PivotTable report is an interactive table which allows the user to have multiple views of data. By changing the view, the |
...
PivotTable report can show different summaries of the data or drill down to display more details for particular areas. ExcelWriter allows you to include |
...
PivotTables in an |
...
ExcelWriter template |
...
file. If there are |
...
PivotTables in the original template file, they will be preserved when the template is processed using ExcelWriter. |
Note |
---|
When using the ExcelApplication object to modify an existing spreadsheet, the following steps are not required; these steps are necessary only when opening a file containing data markers (i.e. an ExcelWriter template). |
- What is a data marker?
- Data markers and pivot tables
- How to Create an ExcelWriter Template with pivot tables
Anchor
Table of Contents | ||
---|---|---|
|
What is a data marker?
An ExcelWriter template is template is a file created in Microsoft Excel that contains data markers. A *data marker* is a cell value beginning with %%= or or %%=$ that that specifies a database column, variable, or array to insert in the spreadsheet cell or column containing the marker. ExcelWriter gets values at runtime from a data source and imports them to spreadsheet data markers.
For detailed information on data markers, see Creating Data Markers. Anchor
Data markers and
...
PivotTables
ExcelTemplate data markers can be used to bind data to a template for use with a pivot tablePivotTable. When ExcelTemplate binds the data to the data markers, it also updates the range that the pivot table PivotTable uses as a pivot table PivotTable cache. By setting the pivot tables PivotTables to refresh on opening, they will automatically bring in the new values from the pivot table PivotTable cache. Anchor
How to
...
create and ExcelWriter Template with
...
PivotTables
Create a template file containing data markers, each with their own column heading (see [How To Use Templates]). Do not create any of the
pivot tablesPivotTables yet.
!Data Markers.png!
#- Create a pivot table
In Excel 2003:
UseUse Microsoft Excel's
pivot table_PivotTable and PivotChart Report Wizard_ to create a
pivot tablePivotTable referencing the range of cells containing the column headings and data markers.
!PivotTableWizard.png!*
In Excel 2007 or above:
* UseUse the Ribbon controls (in Excel 2007 and beyond) to create a
pivot tablePivotTable referencing the range of cells containing the column headings and data markers.
!PivotTableRibbon.png!
# Specify the initial layout and field formatting for the
pivot tablePivotTable. Place the
pivot tablePivotTable in any worksheet you desire. (See the Excel documentation for more details about creating your
pivot tablePivotTable.)
#In Excel 2003:
BeforeBefore clicking "Finish" in the Wizard, click the "Options" button and make sure that "Refresh on open" is checked.
!RefreshOnOpen2003.png!*
In Excel 2007 or above:
*After creating the
Pivot TablePivotTable, right-click on the table and select "
pivot tablePivotTable Options". Click on the Data tab and make sure that "Refresh data on opening the file" is checked. Also, make sure to select
None fromNone from the Number of items to retain per field
!PT_DataOptions_New.
png!
#
In your newly created
pivot tablePivotTable, you will now see the data markers. Data markers in the
pivot tablePivotTable will be ignored by ExcelWriter, which will instead update the data source.
!Finished Table.png!
# RepeatRepeat steps 2 through 5 for every
pivot tablePivotTable you wish to create. Finish creating your template file and save it in the location on your server which will be accessed by your ExcelWriter script.
scrollbar