Page 1 of 1

Exporting data from Excel to GAMS

Posted: Thu Apr 22, 2021 6:18 pm
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 179 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 186 times
textexcel1.log
(1.61 KiB) Downloaded 179 times

Re: Exporting data from Excel to GAMS

Posted: Thu Apr 22, 2021 10:32 pm
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