import GAMS data to Excel

370 views
Skip to first unread message

beril cörüt

unread,
Oct 3, 2011, 3:48:58 PM10/3/11
to gamsworld
i have a problem about import GAMS data to Excel (GAMS to Excel). Can
anybody help me about this subject? Because i couldn't find any
explanatory source and also i couldn't understand what should i do,
i'm doing the examples on GAMS but it is always giving error, can
anybody tell me the process step by step?

Federico Perea

unread,
Oct 4, 2011, 4:28:33 AM10/4/11
to gams...@googlegroups.com
Hello Beril,
 
the next piece of code exports variable r values, paraemetrs cant and alpha values into an excel file called "results_lexicografico", on sheet ("Hoja" in spanish) 9, in the ranges indicated.
 
Hope this helps!
 
Fede
 
*=== Export to Excel using GDX utilities
*=== First unload to GDX file (occurs during execution phase)
execute_unload "results_lexicografico.gdx" r.l cant alpha
*=== Now write to variable levels to Excel file from GDX
execute 'gdxxrw.exe results_lexicografico.gdx par=alpha rng=Hoja9!a31'
execute 'gdxxrw.exe results_lexicografico.gdx var=r.l rng=Hoja9!b33:h34'
execute 'gdxxrw.exe results_lexicografico.gdx par=cant rng=Hoja9!b36:h37'   ;



--
You received this message because you are subscribed to the Google Groups "gamsworld" group.
To post to this group, send email to gams...@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.


Ismail Fahmi

unread,
Oct 4, 2011, 9:58:05 AM10/4/11
to gams...@googlegroups.com
Dear Mr. Corut,

Please look at following website. It should be straight forward; this one is
using GDX feature:

http://www.gams.com/docs/excel/

Another alternative is to put a DISPLAY command below your final solver
statement (i.e. Solve xxx using NLP minimizing z) and then you can simply
open the resulting LST file in Microsoft Excel (with delimited option) and
take the value(s) that you want. Hope it works.

Thank you very much and have a pleasant day.

Sincerely,

Ismail Fahmi
Doctoral Student
Process Systems Engineering Group
Chemical Engineering
University of Tulsa

Keplinger Hall Room U319
800 S Tucker Dr
Tulsa, OK 74104
(918) 812-1280

--

Savitsky Andre

unread,
Oct 4, 2011, 10:57:34 AM10/4/11
to gams...@googlegroups.com
Hi!

Make this
1) change extension in gdxxrw from txt to exe
2) overwrite it in Your GAMS folder. For security reason rename or keep in safe place Your old gdxxrw.exe file
3) Create new project in folder where placed You model
4) Run Your model but in command windows (right upper corner of GAMSIDE) type gdx aaa s solution
5) copy second attachment in You folder
6) change in this attachment X and F name of variable (this variable from my model) to Your variable name
7) run this model but put in command windows of GAMSIDE r solution
8) You will see result in output.xls
I suggest You will be happy!

03.10.2011, 23:48, "beril cörüt" <beril...@gmail.com>:

> --
> You received this message because you are subscribed to the Google Groups "gamsworld" group.
> To post to this group, send email to gams...@googlegroups.com.
> To unsubscribe from this group, send email to gamsworld+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

--
With kindly regards!
Andre Savitsky
E-mail:andre...@yandex.ru
andre...@yahoo.com

gdxxrw.txt
report2.gms

Paul Van der Eijk

unread,
Nov 12, 2012, 2:44:54 PM11/12/12
to gams...@googlegroups.com
EC,

File name is missing in the call of gdxxrw.exe

--Paul

On Sun, Nov 11, 2012 at 9:08 PM, EC <cho....@gmail.com> wrote:
Hi Fede,

I was in a similar situation Beril and used your code.  It created a gdx file but not the XLS, as I had wanted.
could you please tell me what I am missing?
Here is my code:

execute_unload "abc.gdx" UNIT EFP1 EFD1 SSP    //these are all parameters
Execute 'gdxxrw.exe par=UNIT rng=Sheet1!a1:a76'
Execute 'gdxxrw.exe par=EFP1 rng=Sheet1!a1:a76'
Execute 'gdxxrw.exe par=EFD1 rng=Sheet1!b1:b76'
Execute 'gdxxrw.exe par=SSP rng=Sheet1!c1:c76';

execute 'xlstalk -O abc.xls';

Thanks in advance,

EC.
To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/sZcNzFDHnMUJ.

To post to this group, send email to gams...@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.



--
Paul van der Eijk
GAMS Development Corporation
Tel  : (202) 342-0180  Fax  : (202) 342-0181
Email: pvand...@gams.com  
Web : http://www.gams.com

Reply all
Reply to author
Forward
0 new messages