I remember the possibility to export all(!) entries of a GDX-File into a single excel file using one right mouse click in the old GAMS-IDE.
While GAMS-Studio 1.3.5 has now descent possibility to browse GDX-Files, I can only find an export to clipboard function for a single entry of the GDX-File.
Is the export all GDX entries to an excel workbook function still available, and if not, is there any other possibility to export everything at once?
(My model has more than 130 entries, so doing the export by hand is pretty cumbersome, isn’t it?)
At the moment, this is not possible with Studio. However, we extended the Python packages that come with GAMS with GAMS 33, so that you could just add the following to the end of your model to do the task on all platforms:
embeddedCode Python:
import pandas as pd
import gams2numpy
gams.wsWorkingDir = '.'
g2np = gams2numpy.Gams2Numpy(gams.ws.system_directory)
writer = pd.ExcelWriter('all.xlsx', engine='openpyxl')
for sym in gams.db:
arr = g2np.gmdReadSymbolStr(gams.db, sym.name)
pd.DataFrame(data=arr).to_excel(writer, sheet_name=sym.name)
writer.save()
endEmbeddedCode