I am trying to write output data from my GAMS model to Excel using GDXXRW.
There are several parameters that I want to write to Excel in a single collated table:
Power_1(t, i)
Power_2(t)
Power_3(t)
Power_4(t)
Power_5(t)
Power_6(t)
Power_7(t)
Power_8(t)
They all share the same set t, which is defined by t1t24.
Plus Power_1 has the additional set i, which is defined by s1s2.
The issue is that Power_1(t,i) automatically writes to excel with t1t24 as the first column, whereas all others automatically write to excel with t1t24 as the first row. I also am not sure how to merge the set t.
I have been playing with the following code:
execute_unload “results.gdx” Power_1.L, Power_2.L, Power_3.L, Power_4.L, Power_5.L, Power_6.L, Power_7.L,
execute ‘gdxxrw.exe results.gdx o=results.xlsx SQ=N var=Power_1.L rng=results!A1’
execute ‘gdxxrw.exe results.gdx o=results.xlsx SQ=N var=Power_2.L rng=results!D1’
I would like to create the following table, where t1*t24 is the first column and all variables are
The first i colums will read s1, s2, … not Power_1(s1), Power_1(s2), but if you know the cardinality of i you can use gdxxrw’s hText option to alter the heading: