Hello,
I had used GAMS over 10 years ago and I am getting back to it.
I am trying to read some data from an Excel workbook. I do not get any error messages; however, when I try to display the data, it is empty.
I would appreciate any assistance you can provide.
Here is my code.
Set
WorkStnID “Array of IDs for Work stations or work areas”
;
$call msappavail -Excel
$if errorlevel 1 $abort.noerror ‘Microsoft Excel is not available!’;
$CALL GDXXRW C:\Projects\Consulting\PTL\Documents\Scheduler_Input_Tables.xlsx Set=WorkStnID rng=WorkStnID!a2:a19
$GDXIN C:\Projects\Consulting\PTL\Model\Scheduler_Input_Tables.gdx
$LOAD WorkStnID
*$GDXIN
display WorkStnID;
Best,
Shekhar
\
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 http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Hi Chandrashekhar
You could add trace = 3 to the call. Gdxxrw will then write a more detailed report to your log file (and your console).
Cheers
Renger
From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Chandrashekhar Khot
Sent: Donnerstag, 24. September 2015 19:02
To: gamsworld
Subject: Data Not Read from Excel?
Hello,
I had used GAMS over 10 years ago and I am getting back to it.
I am trying to read some data from an Excel workbook. I do not get any error messages; however, when I try to display the data, it is empty.
I would appreciate any assistance you can provide.
Here is my code.
Set
WorkStnID “Array of IDs for Work stations or work areas”
;
$call msappavail -Excel
$if errorlevel 1 $abort.noerror ‘Microsoft Excel is not available!’;
$CALL GDXXRW C:\Projects\Consulting\PTL\Documents\Scheduler_Input_Tables.xlsx Set=WorkStnID rng=WorkStnID!a2:a19
$GDXIN C:\Projects\Consulting\PTL\Model\Scheduler_Input_Tables.gdx
$LOAD WorkStnID
*$GDXIN
display WorkStnID;
Best,
Shekhar
\
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 http://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 http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.
Actually, I figured out what the problem was.
The GDXXRW function is designed to read a two-dimensional array and I was trying to use it to read in the elements of a set. When I added the “rdim=1” option to the statement, it worked fine and read the elements for the set.
On Friday, September 25, 2015 at 1:27:02 AM UTC-5, Chandrashekhar Khot wrote:
Hello,
I had used GAMS over 10 years ago and I am getting back to it.
I am trying to read some data from an Excel workbook. I do not get any error messages; however, when I try to display the data, it is empty.
I would appreciate any assistance you can provide.
Here is my code.
Set
WorkStnID “Array of IDs for Work stations or work areas”
;
$call msappavail -Excel
$if errorlevel 1 $abort.noerror ‘Microsoft Excel is not available!’;
$CALL GDXXRW C:\Projects\Consulting\PTL\Documents\Scheduler_Input_Tables.xlsx Set=WorkStnID rng=WorkStnID!a2:a19
$GDXIN C:\Projects\Consulting\PTL\Model\Scheduler_Input_Tables.gdx
$LOAD WorkStnID
*$GDXIN
display WorkStnID;
Best,
Shekhar
\
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 http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.