Rng=

Top  Previous  Next

To write data to or read data from a spreadsheet a range needs to be specified for each GAMS item to be transferred.  A range is specified using the syntax:

 

Rng=SheetName!CellRange

 

where

SheetName!CellRange is standard Excel notation

Rng= (where capitalization does not matter) alerts Gdxxrw that a range name is following

Sheetname is the name of a sheet within the Excel workbook

! is the exclamation point symbol

CellRange is specified by using TopLeft:BottomRight or TopLeft..BottomRight  or Rangename cell notation like A1:C12 or B1..Q221 or Myrange.

but a complete specification is not required.  In particular, when

Sheetname and CellRange or the whole Rng= entry are omitted the first sheet cell A1 is addressed
Sheetname is omitted the first sheet is addressed i.e. use of Rng=B2 would address the first sheet in the B2 cell (Note this can be altered using the NameConv or NC parameter)
Sheetname is specified and the sheet does not exist, then
when writing to a spreadsheet a new sheet will be added to the workbook with that name.
when reading from a spreadsheet an error will occur if the named sheet is not present.
CellRange is omitted cell A1 is addressed
!CellRange appears the range identified by Cellrange is addressed in the first sheet
CellRange is specified by Rng=TopLeft only then the program will extend the range as far down and to the right as needed wiping out all sheet contents below and to the right of the starting point. (this is also controlled by the skipempty parameter as discussed below)
CellRange can be specified as Rng=namedrange and the program will search for a predefined Excel range with that name.  When the name does not exist an error will occur.