GDXXRW issues for a newbie

questions about GAMS' tools
Post Reply
polppp
User
User
Posts: 3
Joined: 3 months ago

GDXXRW issues for a newbie

Post by polppp » 3 months ago

Hello,

I am trying to read some parameters from excel to gams. I am creating the gdx. file with this command:

$call gdxxrw.exe Book1.xls par=alpha rng=sheet1!A2:B3 ;

And then I am trying to load the data with:

$gdxin Book1.gdx
$load alpha
$gdxin

As you can see in the attachment the error I am taking says that there is no such file and it is true. Why there is no Book1.gdx file? Can anybody help me please..
Attachments
gams.PNG

User avatar
bussieck
Moderator
Moderator
Posts: 208
Joined: 2 years ago

Re: GDXXRW issues for a newbie

Post by bussieck » 3 months ago

Hi,

Never call an external program without checking the return code:

Code: Select all

$call gdxxrw.exe Book1.xls par=alpha rng=sheet1!A2:B3 ; 
$if errorlevel 1 $abort problems with running gdxxrw

* Now continue to load GDX data
$gdxin Book1.gdx
$load alpha
In your case gdxxrw fails and gives the message "Unknown option =" (from your screenshot). Not clear I understand why that is giving your description of the gdxxrw command. The only thing that looks suspicious is the tailing semicolon ';' at the end of the $call gdxxrw line. GAMS statements are terminated by ';' $call is a compile directive (also called dollar control option, https://www.gams.com/latest/docs/UG_Dol ... DOLLARcall) to call an external program at compile time, not a GAMS statement (https://www.gams.com/latest/docs/UG_GAM ... Statements). If removing the ';' does not help, post your spreadsheet and the part of your GAMS code that does the Excel reading.

-Michael

Post Reply