Page 2 of 2

Re: excel to gams

Posted: Sun Dec 24, 2017 10:56 pm
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
;

Re: excel to gams

Posted: Tue Feb 27, 2018 4:30 pm
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

Re: excel to gams

Posted: Wed Feb 28, 2018 8:50 am
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 3426 times
t2.JPG
t3.JPG
t3.JPG (11.56 KiB) Viewed 3426 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