Exporting data from Excel to GAMS

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

Exporting data from Excel to GAMS

Post by bhavya_18 » 2 weeks ago

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 12 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 16 times
textexcel1.log
(1.61 KiB) Downloaded 7 times

abhosekar
Moderator
Moderator
Posts: 143
Joined: 7 months ago

Re: Exporting data from Excel to GAMS

Post by abhosekar » 2 weeks ago

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