Skip to content

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:

  1. Create an Excel workbook template with desired analysis, formatting, charts, etc. Leave placeholders for data sheets. Refer to the data sheets using named ranges.
  2. Read the Excel workbook template using the ReadExcelWorkbook command.
  3. Manipulate the Excel workbook using StateDMI commands that write to Excel, for example WriteTableToExcel. If the KeepOpen=False parameter is used, the original file will not be re-written. Therefore, use KeepOpen=True in combination with the following.
  4. Use the CloseExcelWorkbook command and specify WriteFile=True to force writing the Excel workbook. The NewOutputFile 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

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