Import Data From Excel to GAMS Using xls2gms

questions about GAMS' tools
Post Reply
deadlock
User
User
Posts: 1
Joined: 4 years ago

Import Data From Excel to GAMS Using xls2gms

Post by deadlock »

I was trying to import data from an excel file to GAMS for a parameter and a set but it didn't work.
I successfully created an inc file using xls2gms.exe, I can view it and it seems like it read the data correctly. But I'm unable to import it to GAMS.

But when trying to import it to parameter like this:

Parameter pl(i) 'prod. levels' /$include cci.inc /;

I get those errors for the above code:

Error Messages


1 Real number expected
170 Domain violation for element
338 Unique element expected - symbol was not an element
and the following text will be skipped until a proper
symbol is found to recover. Remember that an UNQUOTED
element has to start with a letter or digit
followed by letters, digits, '+', '-' or '_'. The length
is limited to 63 characters. The following words are
reserved (starting symbols of a GAMS statement) and cannot
be used for UNQUOTED set elements:

ABORT, ACRONYM(S), ALIAS, BINARY, DISPLAY, ELSE
EQUATION(S), EXECUTE, FILE(S), FOR, FREE, IF, INTEGER, LOOP
MODEL(S), NEGATIVE, OPTION(S), PARAMETER(S)
POSITIVE, PROCEDURE(S), PUT, PUTCLEAR, PUTCLOSE, PUTHD
PUTPAGE, PUTTL, SCALAR(S), SEMICONT, SET(S), SOS1, SOS2
TABLE, VARIABLE(S), WHILE

QUOTED elements can contain any character. Single and
double quotes can be used (starting and ending quote have
to match).
409 Unrecognizable item - skip to find a new statement
looking for a ';' or a key word to get started again


And then when I try to import it to a set like this:

Set pl ' prod. levels'
/ $include cci.inc /;


I get these following errors:

Error Messages


338 Unique element expected - symbol was not an element
and the following text will be skipped until a proper
symbol is found to recover. Remember that an UNQUOTED
element has to start with a letter or digit
followed by letters, digits, '+', '-' or '_'. The length
is limited to 63 characters. The following words are
reserved (starting symbols of a GAMS statement) and cannot
be used for UNQUOTED set elements:

ABORT, ACRONYM(S), ALIAS, BINARY, DISPLAY, ELSE
EQUATION(S), EXECUTE, FILE(S), FOR, FREE, IF, INTEGER, LOOP
MODEL(S), NEGATIVE, OPTION(S), PARAMETER(S)
POSITIVE, PROCEDURE(S), PUT, PUTCLEAR, PUTCLOSE, PUTHD
PUTPAGE, PUTTL, SCALAR(S), SEMICONT, SET(S), SOS1, SOS2
TABLE, VARIABLE(S), WHILE

QUOTED elements can contain any character. Single and
double quotes can be used (starting and ending quote have
to match).
409 Unrecognizable item - skip to find a new statement
looking for a ';' or a key word to get started again


I'd really appreciate if someone could help me with this problem I described above.
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: Import Data From Excel to GAMS Using xls2gms

Post by Renger »

Hi
It is hard to see where the problem is, as you either supplied the code you used nor the include file.
Please read the guidelines before posting.
CHeers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Post Reply