text file or excel file imported to GAMS as parameter

Archive of Gamsworld Google Group
Post Reply
Archiver
User
User
Posts: 7876
Joined: 7 years ago

text file or excel file imported to GAMS as parameter

Post by Archiver »


Hi everyone,

I'm struggling to import a datasheet from excel or notepad (it does't actually matter which one, i created both) but i keep on getting error 492 "Symbol not in GDX" in the case i try to import from excel.
Can anyone help me?

Thanks a lot in advance!

Ornella

*******The part of script that is giving me problems*************

$call gdxxrw DTD.xlsx par=Sheet1 rng=A1:B8761

PARAMETER DTD(t) Digester thermal load;

$GDXIN DTD.gdx
$LOAD DTD
$GDXIN

What I need to import is a vector (DTD) of one column and 8760 rows.
t is a set for hours per year
t /t1*t24/ (I am currently using a reduced set to test the code).

I placed the xlxs file into the projdir directory, but still it doesn't work.
I bag someone's help.

--
Attachments
Optimization modelSG.gms
(10.36 KiB) Downloaded 301 times
DTD.xlsx
(245.2 KiB) Downloaded 291 times
Archiver
User
User
Posts: 7876
Joined: 7 years ago

RE: text file or excel file imported to GAMS as parameter

Post by Archiver »


Hi on ella
Take a close look at your call. You are trying to get parameter par=sheet1. ..and DtD in sheet.
Cheese
Renger
Ps sorry, but Gams is not running on my cellphone (yet), so I don't know if this will solve your issue



Sent from my Samsung Note 4


-------- Original message --------
From: Ornella Forte
Date: 1/26/2016 15:54 (GMT+01:00)
To: gamsworld
Subject: text file or excel file imported to GAMS as parameter

Hi everyone,

I'm struggling to import a datasheet from excel or notepad (it does't actually matter which one, i created both) but i keep on getting error 492 "Symbol not in GDX" in the case i try to import from excel.
Can anyone help me?

Thanks a lot in advance!

Ornella

*******The part of script that is giving me problems*************

$call gdxxrw DTD.xlsx par=Sheet1 rng=A1:B8761

PARAMETER DTD(t) Digester thermal load;

$GDXIN DTD.gdx
$LOAD DTD
$GDXIN

What I need to import is a vector (DTD) of one column and 8760 rows.
t is a set for hours per year
t /t1*t24/ (I am currently using a reduced set to test the code).

I placed the xlxs file into the projdir directory, but still it doesn't work.
I bag someone's help.

--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Archiver
User
User
Posts: 7876
Joined: 7 years ago

Re: text file or excel file imported to GAMS as parameter

Post by Archiver »


Hi Renger,

thanks for your answer.
Actually I don't know how that part of script came like that (maybe an old wrong version).
This is actually what I'm running and doesn't work.

$CALL GDXXRW.EXE DTD.xls par=DTD rng=sheet1!A1:B8760

Parameter DTD(t);

$GDXIN DTD.gdx
$LOAD DTD
$GDXIN


Il giorno martedì 26 gennaio 2016 15:45:02 UTC, Renger van Nieuwkoop ha scritto:

Hi on ella
Take a close look at your call. You are trying to get parameter par=sheet1. ..and DtD in sheet.
Cheese
Renger
Ps sorry, but Gams is not running on my cellphone (yet), so I don't know if this will solve your issue



Sent from my Samsung Note 4


-------- Original message --------
From: Ornella Forte
Date: 1/26/2016 15:54 (GMT+01:00)
To: gamsworld
Subject: text file or excel file imported to GAMS as parameter

Hi everyone,

I'm struggling to import a datasheet from excel or notepad (it does't actually matter which one, i created both) but i keep on getting error 492 "Symbol not in GDX" in the case i try to import from excel.
Can anyone help me?

Thanks a lot in advance!

Ornella

*******The part of script that is giving me problems*************

$call gdxxrw DTD.xlsx par=Sheet1 rng=A1:B8761

PARAMETER DTD(t) Digester thermal load;

$GDXIN DTD.gdx
$LOAD DTD
$GDXIN

What I need to import is a vector (DTD) of one column and 8760 rows.
t is a set for hours per year
t /t1*t24/ (I am currently using a reduced set to test the code).

I placed the xlxs file into the projdir directory, but still it doesn't work.
I bag someone's help.

--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Archiver
User
User
Posts: 7876
Joined: 7 years ago

RE: text file or excel file imported to GAMS as parameter

Post by Archiver »


HI Ornella



Two things:

- The ending of the file you sent is “xlsx” and not “xls”

- The parameter you are reading has two dimensions (t in column A, and the heading of column B), so either you define DTD as DTD(t,*) or you define DTD as DTD(t) and let the range start at the second row and you set the RDIM to 1 ($call GDXXRW.EXE DTD.xlsx par=DTD rdim=1 rng=sheet1!A2:B8760)



Cheers

Renger



From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Ornella Forte
Sent: Dienstag, 26. Januar 2016 17:17
To: gamsworld
Subject: Re: text file or excel file imported to GAMS as parameter



Hi Renger,



thanks for your answer.

Actually I don't know how that part of script came like that (maybe an old wrong version).

This is actually what I'm running and doesn't work.



$CALL GDXXRW.EXE DTD.xls par=DTD rng=sheet1!A1:B8760



Parameter DTD(t);



$GDXIN DTD.gdx

$LOAD DTD

$GDXIN




Il giorno martedì 26 gennaio 2016 15:45:02 UTC, Renger van Nieuwkoop ha scritto:

Hi on ella

Take a close look at your call. You are trying to get parameter par=sheet1. ..and DtD in sheet.

Cheese

Renger

Ps sorry, but Gams is not running on my cellphone (yet), so I don't know if this will solve your issue







Sent from my Samsung Note 4



-------- Original message --------
From: Ornella Forte
Date: 1/26/2016 15:54 (GMT+01:00)
To: gamsworld
Subject: text file or excel file imported to GAMS as parameter

Hi everyone,



I'm struggling to import a datasheet from excel or notepad (it does't actually matter which one, i created both) but i keep on getting error 492 "Symbol not in GDX" in the case i try to import from excel.

Can anyone help me?



Thanks a lot in advance!



Ornella



*******The part of script that is giving me problems*************



$call gdxxrw DTD.xlsx par=Sheet1 rng=A1:B8761



PARAMETER DTD(t) Digester thermal load;



$GDXIN DTD.gdx

$LOAD DTD

$GDXIN



What I need to import is a vector (DTD) of one column and 8760 rows.

t is a set for hours per year

t /t1*t24/ (I am currently using a reduced set to test the code).



I placed the xlxs file into the projdir directory, but still it doesn't work.

I bag someone's help.

--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

--
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Post Reply