Exporting data from Excel to GAMS

Problems with syntax of GAMS
Post Reply
bhavya_18
User
User
Posts: 1
Joined: 2 years ago

Exporting data from Excel to GAMS

Post by bhavya_18 »

Hi everyone, I'm a economics students and I'm trying to export data from excel to GAMS but
indata.xlsx
(8.17 KiB) Downloaded 175 times
couldn't export. I'm attaching a GAMS code which I tried to export data from excel.
Kindly help.
textexcel1.gms
(219 Bytes) Downloaded 181 times
textexcel1.log
(1.61 KiB) Downloaded 175 times
abhosekar
Moderator
Moderator
Posts: 295
Joined: 3 years ago

Re: Exporting data from Excel to GAMS

Post by abhosekar »

Two mistakes.
1. File extension .xlxs instead of .xlsx
2. You should not indent $call and $gdxin. Remove the space behind it

After fixing, the following code works

Code: Select all

    set r row labels /r1,r2/
    c coloumn labels/c1,c2/;
Parameter p(r,c);
$call GDXXRW indata.xlsx trace=3 par=p rng=sheet1!a1 rdim=1 cdim=1
$GDXIN indata.gdx
$load p
$GDXIN
    
Display p;
- Atharv
Post Reply