Parameters in a spreadsheet

Top  Previous  Next

Command line parameters can be placed in a range of a spreadsheet then read.  This is indicated by including the use of the Index command line parameter

 

Index = ExcelRange

Example:

Suppose I wish to integrate all the features of the gdxxrwread.gms example into an index area of a spreadsheet.  I can do this using the myindex sheet of the gdxxrwss.xls spreadsheet and the GAMS code in the example gdxxrwread2.gms as follows

 

$call gdxxrw gdxxrwss.xls o=gdxall.gdx index=myindex!a1

 

where the myindex sheet looks like

 

_img101

Notes:

The parameters are read using the specified range, and treated as if they appeared directly on the command line.
In the spreadsheet the first three columns of the range have a fixed interpretation: DataType (Par, Set, Dset, Equ, or Var), Item name identifier and spreadsheet data range.  The fourth and following columns can be used for additional parameters like dim, rdim, cdim , merge, clear and skipempty.  The column header contains the keyword when necessary, and the Cell content is used as the option value.
When an entry appears in a column without a heading then it is directly copied into the Gdxxrw parameter file.  Thus in the example the items in column G are directly copied into the file.
Rows do not have to have entries in the first three columns if one just wants to enter persistent options such as skipempty or some of the special character string redefinitions.

Another Example:

The GAMS program gdxxrwwrite2.gms employs the use of an index area in a workbook in writing.  Namely in the writeindex sheet of gdxxrwss.xls I have

 

_img102

 

which is addressed by the command

$call "gdxxrw i=gdxse.gdx o=gdxxrwss.xls  index=writeindex!a2"

 

and shows how the merge and clear commands are entered.