excel to gams

Problems with syntax of GAMS
Job
User
User
Posts: 5
Joined: 9 months ago

Re: excel to gams

Post by Job » 5 months ago

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: 9 months ago

Re: excel to gams

Post by Dbroz » 3 months ago

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: 110
Joined: 1 year ago

Re: excel to gams

Post by bussieck » 3 months ago

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 291 times
t2.JPG
t3.JPG
t3.JPG (11.56 KiB) Viewed 291 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