Description
At first, the skipEmpty parameter is used to skip empty rows or columns when reading data while using the top left corner range specification. Afterwards, the ignoreRows resp. ignoreColumns parameter is demonstrated. This model is referenced in "Skipping Empty Rows and Columns" resp. "Ignoring Rows and Columns" from the GDXXRW Documentation.
Category : GAMS Data Utilities library
Main file : GDXXRWExample21.gms includes : exampleData.xlsx GDXXRWExample21.gms
$title Skipping empty Rows or Columns and Ignoring Rows or Columns (GDXXRWExample21,SEQ=123)
$onText
At first, the skipEmpty parameter is used to skip empty rows or columns when
reading data while using the top left corner range specification. Afterwards,
the ignoreRows resp. ignoreColumns parameter is demonstrated.
This model is referenced in "Skipping Empty Rows and Columns" resp. "Ignoring
Rows and Columns" from the GDXXRW Documentation.
$offText
$callTool win32.msappavail Excel
$if errorlevel 1 $abort.noError "No Excel available"
* Skipping empty rows and columns
Parameter
A_d 'results for the default value of skipEmpty (skipEmpty=1), i.e. skip single blank rows or columns'
A_0 'results for skipEmpty=0, i.e. terminating reading if a blank row resp. column is encountered';
$onEcho > howToRead.txt
par=A_d rng=skippingRC!A2 rDim=2 cDim=1
se=0 par=A_0 rng=skippingRC!A2 rDim=2 cDim=1
$offEcho
$call gdxxrw exampleData.xlsx output=skipEmpty.gdx @howToRead.txt trace=0
$ifE errorLevel<>0 $abort Error reading from spreadsheet using skipEmpty!
* load the data
$gdxIn skipEmpty.gdx
$load A_d A_0
$gdxIn
display A_d, A_0;
* ------------------------------------------------------------------------------
* Ignoring rows and columns
Parameter A 'results for ignored rows 2,6 and ignored columns D,G';
$call gdxxrw exampleData.xlsx output=ignoring.gdx par=A rng=ignoringRC!C1 cDim=2 rDim=2 ignoreRows=2,6 ignoreColumns=D,G trace=0
$ifE errorLevel<>0 $abort Error reading from spreadsheet using ignoreRows and ignoreColumns!
* load the data
$gdxIn ignoring.gdx
$load A
$gdxIn
display A;