GDXXRWExample5.gms : Reads a two dimensional parameter from an MS Excel file and writes it to a GDX file

Description

This program illustrates reading a table from an Excel
spreadsheet with row and column dimension of magnitude
1.


Category : GAMS Data Utilities library


Main file : GDXXRWExample5.gms   includes :  Test1.xls  GDXXRWExample5.gms

$ontext

This program illustrates reading a table from an Excel
spreadsheet with row and column dimension of magnitude
1.

$offtext

$if %system.filesys% == UNIX $abort.noerror 'This model cannot run on a non-Windows platform';
$call msappavail -Excel
$if errorlevel 1 $abort.noerror 'Microsoft Excel is not available!';

 sets i row entries    /i1,i2/
      a column entries /a1, a2,a3/ ;

 parameter data1(i,a);

$CALL GDXXRW Test1.xls par=data1 rng=a1:d3 Cdim=1 Rdim=1 trace=0
$GDXIN Test1.gdx
$LOAD data1
$GDXIN

display data1;


* Data Validation
table exp_data1 (i,a) expected_data1
         a1       a2       a3
i1        1        2        3
i2        4        5        6;
set error01(i,a) unexpected value;
error01(i,a) = exp_data1(i,a)<>data1(i,a);
abort$card(error01) error01;