Page 1 of 1

Excel to gams

Posted: Sun Dec 03, 2017 8:59 pm
by mahyar
Hi Everyone.
I have a problem.
I want to import data from excel to gams.i has written the following code

$call GDXXRW.exe indata1.xlsx trace=3 par=a rng=Interval!a1 rdim=1 cdim=1
$load a
display a;

but no value has been assigned.
I attached my files.

Re: Excel to gams

Posted: Mon Dec 04, 2017 11:27 am
by Renger
Hi Mayhar

You use rdim=1 cdim=1 which implies a dimension of 2, but you define a as a(i), which has a dimension of 1 (i). So either you keep a(i) and write (note that I start at a2):
parameter a(i) beginning of interval for jobs
$call 'GDXXRW.exe indata1.xlsx par=a rng=Interval!a2 rdim=1 trace = 3'
$gdxin 'indata1.gdx';
$load a
display a
Or you make the parameter a two-dimensional, e.g. a(i,*) and you write
parameter a(i,*) beginning of interval for jobs
$call 'GDXXRW.exe indata1.xlsx par=a rng=Interval!a1 rdim=1 cdim=1 trace = 3'

$gdxin 'indata1.gdx';
$load a
display a
Hope, this helps
Cheers
Renger

Re: Excel to gams

Posted: Sun Dec 24, 2017 10:47 pm
by Job
This is my codes to transfer data from excel to GAMS. The code works well but the data display is "TRUE" for all cells and when the variables are called the data turns to "1.000" all. Some of the data are actually "1.000", but not all. Please what can I do. I need urgent help to continue with my project.

$CALL GDXXRW.EXE Nigeria_data.xlsx par=tyyz rng=sheet2!a1..k10
$GDXIN Nigeria_data.gdx
$LOADDC tyyz
$GDXIN
;