This section describes how to use
Wraps an excel workbook into a discipline.
As this wrapper relies on the xlswings library to handle macros and interprocess communication, it is only working under Windows and MacOS.
Initialize xls file path and macro.
Inputs must be specified in the “Inputs” sheet, in the following format (A and B are the first two columns)
Where a is the name of the first input, and 1 is its default value b is the name of the second one, and 2 its default value.
There must be no empty lines between the inputs
The number of rows is arbitrary but they must be contiguous and start at line 1
And same for the “Outputs” sheet (A and B are the first two columns)
Where c is the only output. There may be multiple.
if the file is a .xlsm, a macro named “execute” must exist and will be called by the _run method before retrieving the outputs. The macro has no arguments, it takes its inputs in the Inputs sheet, and write the outputs to the “Outputs” sheet
Alternatively, the user may provide a macro name to the constructor, or None if no macro shall be executed
xls_file_path (str) – path to the excel file if the file is a .xlsm, a macro named “execute” must exist and will be called by the _run method before retrieving the outputs
macro_name (str) – name of the macro to be executed for a .xlsm file if None is provided, do not run a macro
The next figure illustrates how a macro can be wrapped to compute outputs from inputs.