GDXXRWExample10.gms : Reading Spreadsheet using the index Option

Description

This program illustrates reading a number of parameters and
sets using the index option. The index data is primarily a list
of set and parameter ranges, their dimensions and some additional options.

This model is referenced in "Reading Spreadsheet using the index Option" from
the GDXXRW Documentation.


Category : GAMS Data Utilities library


Main file : GDXXRWExample10.gms   includes :  GDXXRWExample10.gms  exampleData.xlsx

$title Reading Spreadsheet using the index Option (GDXXRWExample10,SEQ=021)

$onText
This program illustrates reading a number of parameters and
sets using the index option. The index data is primarily a list
of set and parameter ranges, their dimensions and some additional options.

This model is referenced in "Reading Spreadsheet using the index Option" from
the GDXXRW Documentation.
$offText

$callTool win32.msappavail Excel
$if errorlevel 1 $abort.noError "No Excel available"

* Declaring the data
Set
   i1  'dataType "set", no data range'
   i1a 'dataType "dSet", no data range'
   i2  'dataType "set", adding values option yn'
   i3  'dataType "set", adding values option sparse'
   i4  'dataType "set", no data range, using the top left corner specification to demonstrate skipEmpty=1 (default)'
   i4a 'dataType "set", no data range, using the top left corner specification to demonstrate skipEmpty=0'
   i5  'dataType "set", using the top left corner specification to demonstrate skipEmpty=0'
   i6  'dataType "set", adding values option noData, skipEmpty is set back to default'
   i6a 'dataType "dSet"'
   i6b 'dataType "dSet"'
   j4  'dataType "dSet"'
   i7  'dataType "dSet"'
   i8  'dataType "dSet"'
   i9  'dataType "set", adding values option noData'
   i10 'dataType "set", adding values option noData';

Parameter
   distance     'two-dimensional parameter   (cDim=1, rDim=1)'
   modedistance 'three-dimensional parameter (cDim=2, rDim=1)';

* Reading symbol specifications directly from spreadsheet using the index option
$call gdxxrw exampleData.xlsx output=gdxAll.gdx index=index!A1 trace=0
$ifE errorLevel<>0 $abort Error reading spreadsheet with index option!

* Load the data
$gdxIn gdxAll.gdx
$load i1 i1a i2 i3 i4 i4a i5 i6 i6a i6b j4 i7 i8 i9 i10 distance modedistance
$gdxIn

display i1, i1a, i2, i3, i4, i4a, i5, i6, i6a, i6b, j4, i7, i8, i9, i10, distance, modedistance;