StateDMI / Command / ReadExcelWorkbook
Overview
The ReadExcelWorkbook
command reads a Microsoft Excel workbook file (*.xls
, *.xlsx
, *.xlsm
).
The workbook is retained in memory and can be manipulated using commands that write to Excel, for example:
- Create an Excel workbook template with desired analysis, formatting, charts, etc. Leave placeholders for data sheets. Refer to the data sheets using named ranges.
- Read the Excel workbook template using the
ReadExcelWorkbook
command. - Manipulate the Excel workbook using StateDMI commands that write to Excel, for example
WriteTableToExcel
. If theKeepOpen=False
parameter is used, the original file will not be re-written. Therefore, useKeepOpen=True
in combination with the following. - Use the
CloseExcelWorkbook
command and specifyWriteFile=True
to force writing the Excel workbook. TheNewOutputFile
parameter can also be specified to write a new output file, leaving the original Excel file intact.
StateDMI uses the Apache POI software to read and manipulate Excel workbooks and consequently functionality is constrained by the features of that software package.
Command Editor
The following dialog is used to edit the command and illustrates the syntax of the command. See also the full-size image.
ReadExcelWorkbook
Command Editor
Command Syntax
The command syntax is as follows:
ReadExcelWorkbook(Parameter="Value",...)
Command Parameters
Parameter | Description | Default |
---|---|---|
InputFile required |
The name of the Excel workbook file (*.xls , *.xlsx , or *.xlsm ) to read, as an absolute path or relative to the command file location. Can be specified using processor ${Property} . |
None – must be specified. |
Examples
See the automated tests.
Troubleshooting
See Also
CloseExcelWorkbook
commandWriteTableToExcel
command