PyXLL creates some configuration substitution variables that can be used in any config values.
Variable substitution in the config file follows the same format as Python’s configparser
module,
which is %(name)s
, where name
is the variable name.
For example, including today’s date in the log file name would be specified as:
[LOG]
file = pyxll-log-%(date)s.txt
The following sustitution variables are available:
Substitution Variable | Description |
---|---|
pid | Process id |
date | Current date in YYYYMMDD format |
time [3] | Current time in HHMMSS format |
xl_version [1] | Excel version |
py_version [2] | Python version |
pyxll_version [2] | PyXLL version |
xll_path [3] | Full path of the pyxll.xll add-in |
xll_dir [3] | Directory containing the pyxll.xll add-in |
cfg_path [3] | Full path of the config file being processed |
cfg_dir [3] | Directory containing the config file being processed |
basecfg_path [3] [4] | Full path of the base config file |
basecfg_dir [3] [4] | Directory containing the base config file |
In addition to these standard substition variables, environment variables can also be used as substitution variables in the config. See Environment Variables for more details about using environment variables in the config file.
Footnotes
[1] | xlversion was renamed to xl_version in PyXLL 5.2 but both forms will continue to work. |
[2] | (1, 2) Both the py_version and pyxll_version substitution variables are new in PyXLL 5.2. |
[3] | (1, 2, 3, 4, 5, 6, 7) The options time , xll_path , xll_dir , cfg_path , cfg_dir , basecfg_path , and basecfg_dir are new in PyXLL 5.6. |
[4] | (1, 2) The base config is the first config file loaded by the add-in. This can be different from the config file being processed
if the base config specifies additional config files using the external_config option. |