Hi guys!
I want to import data from excel to GAMS. So I tried to define a GTX data but it doesn’t work out and I can’t find the problem.
Set
t “time” /1*5/;
Parameter C(t);
$call gdxxrw.exe example.xlsx par=t rng=tabelle2!A1:A5 Rdim=1
$GDXIN example.gdx
$LOAD C
$GDXIN
Display C;
example.xlsx is the name of my excel data
tabelle2 is the name of my excel sheet
A1:A5 are the excel cells with my values.
The error " CALL failed" appears.
Is there anyone who knows my fault?
I´m thankful for every advice.
Greetings TheBebbo
Hi,
GDXXRW is a Windows only tool. Are you eventually trying to use it under a different OS?
Fred
Hi Fred,
thanks for your reply! That’s gonna be the problem. I´m using MacOS. Is there an equivalent command for MacOS?
TheBebbo
Nope. Even though Excel is available on the Mac, it does not support the MS Office OLE interface required by gdxxrw which is why gdxxrw is not available for mac/linux (see platform/tool availability matrix in our docs . So you either run gdxxrw on Windows and bring the GDX over to the Mac or export the required sheets to CSV files and read these into GAMS (see https://www.gams.com/latest/docs/UG_DataExchange_ASCII.html or https://www.gams.com/latest/docs/T_CSV2GDX.html).
The upcoming GAMS 39 (beta) will come with the new GAMS Connect framework which allows to integrate data from various data sources (among others Excel). But but this will still take a few weeks.
Fred
With your help I could create the GDX file on windows and sent the cdx file to my MAC. Now I need to open the gdx in GAMS.
$GDXIN Input_data.gdx
$LOAD X, Y , z.
$GDXIN
That’s what I tried but it didn’t work out. Maybe you could help me one more time.
Thank you in advance!
Please share an example that allows other forum users to do what you are doing as suggested in the forum rules.
Fred
Here my example:
Set
t Time /1*50/
Parameters
X(t) Costs for X
Y(t) Costs for Y
Z(t) Costs for Y;
$GDXIN X-Y-Z.gdx
$LOAD X, Y , Z
$GDXIN
In the gdx file are the 50 values for x y z. But if I wanna run the code the error “Unable to open gdx file for $GDXIN” appears.
You have the GDX file in your working directory, do you? Please share the GDX file as well. Otherwise one can still not run your example. Sharing a full log that shows some context around the error would also be good.
Fred
Thank you Fred. I found the problem. The GDX File had more than only the 50 values and I couldn’t use all values because of my demo license.