Reading only a row of excel file

Hi everybody
I need to read only the first row of an excel file (as a set), like bellow

DMU_1 DMU_2 DMU_3 DMU_4 DMU_5 DMU_6 DMU_7
Output_1 2 5 7 8 3 1 7


The problem is that, the range of data is not known. It starts from B1, but the end is not known.

Thanks in advance for your help


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/tzojMT5Ix3gJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Hi Ati

Here is the code for reading the data without knowing how many values there are:

  • Define the set (row headings)
    Set dmu;

  • Define the parameter you want to read
    parameter
    results(*,dmu);

  • Read the data: when you just put the beginning of the range, gdx will read until the end. Date is in the excel file results.xlsx and saved to the results.gdx
    $call gdxxrw.exe i=d:\inbox\results.xlsx o=d:\inbox\results.gdx dset=dmu rng=tabelle1!b1 cdim=1 par=results rng=tabelle1!a1 cdim=1 rdim=1 trace = 3

  • Check if all works fine
    $gdxin d:\inbox\results.gdx
    $load dmu, results

display dmu, results;

Cheers
Renger

From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of ati
Sent: Saturday, October 06, 2012 7:48 AM
To: gamsworld@googlegroups.com
Subject: Reading only a row of excel file

Hi everybody
I need to read only the first row of an excel file (as a set), like bellow


DMU_1
DMU_2
DMU_3
DMU_4
DMU_5
DMU_6
DMU_7
Output_1
2
5
7
8
3
1
7

The problem is that, the range of data is not known. It starts from B1, but the end is not known.

Thanks in advance for your help

thank alot

On Saturday, October 6, 2012 1:10:33 AM UTC-7, Renger van Nieuwkoop wrote:

Hi Ati

Here is the code for reading the data without knowing how many values there are:

  • Define the set (row headings)
    Set dmu;

  • Define the parameter you want to read
    parameter
    results(*,dmu);

  • Read the data: when you just put the beginning of the range, gdx will read until the end. Date is in the excel file results.xlsx and saved to the results.gdx
    $call gdxxrw.exe i=d:\inbox\results.xlsx o=d:\inbox\results.gdx dset=dmu rng=tabelle1!b1 cdim=1 par=results rng=tabelle1!a1 cdim=1 rdim=1 trace = 3

  • Check if all works fine
    $gdxin d:\inbox\results.gdx
    $load dmu, results

display dmu, results;

Cheers
Renger

From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of ati
Sent: Saturday, October 06, 2012 7:48 AM
To: gams...@googlegroups.com
Subject: Reading only a row of excel file

Hi everybody
I need to read only the first row of an excel file (as a set), like bellow


DMU_1
DMU_2
DMU_3
DMU_4
DMU_5
DMU_6
DMU_7
Output_1
2
5
7
8
3
1
7

The problem is that, the range of data is not known. It starts from B1, but the end is not known.

Thanks in advance for your help

To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/tzojMT5Ix3gJ.
To post to this group, send email to gams...@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/L7DFgA9XD-0J.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.