# How to read .gdx files in Julia?

**URL:** <https://discourse.julialang.org/t/how-to-read-gdx-files-in-julia/103575>\
**Category:** Optimization (Mathematical)\
**Tags:** question, package, jump, optimization\
**Created:** [September 6, 2023, 3:39pm UTC](https://discourse.julialang.org/t/how-to-read-gdx-files-in-julia/103575 "2023-09-06T15:39:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Iheb](https://avatars.discourse-cdn.com/v4/letter/i/7bcc69/32.png) [@Iheb](https://discourse.julialang.org/u/Iheb)\
**Post date:** [September 6, 2023, 3:39pm UTC](https://discourse.julialang.org/t/how-to-read-gdx-files-in-julia/103575/1 "2023-09-06T15:39:28Z")

</div>

I have a Multistage SP written in GAMS and I want to exchange data between GAMS and Julia via gdx files (Maybe another method if there exists any).  
I tried using GAMS.jl but it what it does is just convert the model written in JuMP to a .gms file to be executed in GAMS.  
Is there a way to do the reverse?

---

<div class="post-metadata">

**Author:** ![blob](https://avatars.discourse-cdn.com/v4/letter/b/ebca7d/32.png) [@blob](https://discourse.julialang.org/u/blob)\
**Post date:** [September 6, 2023, 4:12pm UTC](https://discourse.julialang.org/t/how-to-read-gdx-files-in-julia/103575/2 "2023-09-06T16:12:33Z")

</div>

It seems that GAMS offers a function CONVERT that supports JuMP: [CONVERT](https://www.gams.com/latest/docs/S_CONVERT.html#CONVERT_Language)

And welcome to the forum 🙂

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [September 10, 2023, 10:33pm UTC](https://discourse.julialang.org/t/how-to-read-gdx-files-in-julia/103575/3 "2023-09-10T22:33:36Z")

</div>

There is an open feature request for this in GAMS’s official interface: [[FR] Accessing GDX files from Julia · Issue #4 · GAMS-dev/gams.jl · GitHub](https://github.com/GAMS-dev/gams.jl/issues/4)

Your best bet is to dump the data from the GDX format into something else, like a set of CSV files, and then read those into Julia: [GDXDUMP](https://www.gams.com/latest/docs/T_GDXDUMP.html#GDXDUMP_EXAMPLES_WRITING_TO_CSV)

Selfish plug, but if you’re doing multistage stochastic programming, you may want to take a look at [GitHub - odow/SDDP.jl: Stochastic Dual Dynamic Programming in Julia](https://github.com/odow/SDDP.jl).
