excel to gams Topic is solved

Problems with syntax of GAMS
Job
User
User
Posts: 6
Joined: 6 years ago

Re: excel to gams

Post by Job »

The codes below turns all my data into "1.000". Please help.

$CALL GDXXRW.EXE Nigeria_data.xlsx par=tyyz rng=sheet2!a1..k10
$GDXIN Nigeria_data.gdx
$LOADDC tyyz
$GDXIN
;
Dbroz
User
User
Posts: 2
Joined: 6 years ago

Re: excel to gams

Post by Dbroz »

Hello group.
I can print date and hour of GAMS execution in TXT. But I need print date and hour of GAMS execution in excel.
Does anyone know a syntax to print date and hour ejecution in excel?
Best regards
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: excel to gams

Post by bussieck »

GAMS and Excel (and many other program work with the Julian date or serial date, a single number represents date and time). Just write this number to Excel and format as date:

Code: Select all

scalar x; x = jnow;
execute_unload 'time', x;
execute 'gdxxrw time.gdx o=time.xlsx par=x rng=a1';
t1.JPG
t1.JPG (10.15 KiB) Viewed 3394 times
t2.JPG
t3.JPG
t3.JPG (11.56 KiB) Viewed 3394 times
There are function to go from serial dates to regular calendar dates and vice versa: https://www.gams.com/latest/docs/UG_Par ... rFunctions

-Michael
Post Reply