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.
Excel to gams
Excel to gams
- Attachments
-
- indata1.xlsx
- (8.44 KiB) Downloaded 324 times
-
- abcd.gms
- (191 Bytes) Downloaded 288 times
Re: Excel to gams
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):
Cheers
Renger
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):
Or you make the parameter a two-dimensional, e.g. a(i,*) and you writeparameter 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
Hope, this helpsparameter 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
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Re: Excel to gams
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
;
$CALL GDXXRW.EXE Nigeria_data.xlsx par=tyyz rng=sheet2!a1..k10
$GDXIN Nigeria_data.gdx
$LOADDC tyyz
$GDXIN
;