TSTool / 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
ReadExcelWorkbookcommand. - Manipulate the Excel workbook using TSTool commands that write to Excel, for example
WriteTableToExcel. If theKeepOpen=Falseparameter is used, the original file will not be re-written. Therefore, useKeepOpen=Truein combination with the following. - Use the
CloseExcelWorkbookcommand and specifyWriteFile=Trueto force writing the Excel workbook. TheNewOutputFileparameter can also be specified to write a new output file, leaving the original Excel file intact.
TSTool 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 command is available in the following TSTool menu:
- Commands / Read Time Series
The following dialog is used to edit the command and illustrates the syntax of the command.
ReadExcelWorkbook Command Editor (see full-size image)
Command Syntax
The command syntax is as follows:
ReadExcelWorkbook(Parameter="Value",...)
Command Parameters
| Parameter | Description | Default |
|---|---|---|
InputFilerequired |
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 the main TSTool Troubleshooting documentation.
See Also
CloseExcelWorkbookcommandWriteTableToExcelcommand