Description
This program reads data from an MS Excel file, modifies it, writes to an GDX file and then finally writes the modifies data to a new sheet in the MS Excel file. This model is referenced in "Reads a table from Spreadsheet, manipulates the Data and writes back to Spreadsheet" from the GDXXRW Documentation.
Category : GAMS Data Utilities library
Main file : GDXXRWExample13.gms includes : GDXXRWExample13.gms Test1.xlsx
$title Reads a Table from Spreadsheet, manipulates the Data and writes back to Spreadsheet (GDXXRWExample13,SEQ=025)
$onText
This program reads data from an MS Excel file, modifies
it, writes to an GDX file and then finally writes the
modifies data to a new sheet in the MS Excel file.
This model is referenced in "Reads a table from Spreadsheet, manipulates the
Data and writes back to Spreadsheet" from the GDXXRW Documentation.
$offText
$callTool win32.msappavail Excel
$if errorlevel 1 $abort.noError "No Excel available"
$call gdxxrw test1.xlsx dSet=I rng=A2:A3 rDim=1 dSet=A rng=B1:D1 cDim=1 par=X rng=A1:D3 rDim=1 cDim=1 trace=0
$gdxIn test1.gdx
Set I(*), A(*);
$load I A
Parameter X(I,A);
$load X
display I, A, X;
$gdxIn
X(I,A) = - X(I,A);
execute_unload 'tmp.gdx', I, A, X;
execute 'gdxxrw tmp.gdx output=test1.xlsx par=X rng=EX6!A1:D3 rDim=1 cDim=1 trace=0';