Reading Sets from Excell Sheets with Connect

questions about GAMS' tools
Post Reply
raphael
User
User
Posts: 1
Joined: 1 month ago

Reading Sets from Excell Sheets with Connect

Post by raphael »

I have a set testSet and the content of the set is defined in an Excel-Sheet. I tried to read it using the ExcelReader from the Connect API but I can not seem to get it done. Can someone give me an explanation of how to get this done?
WhatsApp Image 2024-02-28 at 09.29.38.jpeg
WhatsApp Image 2024-02-28 at 09.29.38.jpeg (10.62 KiB) Viewed 1643 times

Code: Select all

 
set testSet;
$onEmbeddedCode Connect:
- ExcelReader:
    file: Lego-Edit.xlsx
    symbols:
        - name: testSet
          range: Hindex_new!A1:C3
          rowDimension: 0
          columnDimension: 1
          type: set
- GAMSWriter:
    writeAll: True
$offEmbeddedCode
 
 
aileen
User
User
Posts: 136
Joined: 4 years ago

Re: Reading Sets from Excell Sheets with Connect

Post by aileen »

Hi raphael,

From you Excel sheet snippet and the Connect code it is not very clear to me what you are trying to achieve. From the Excel sheet snippet it looks like you are trying to read a 3-dimensional set where the labels are found in A2:C4. But in the Connect code you specified a data range of A1:C3. In addition, by specifying rowDimension: 0 and columnDimension: 1, you are instructing the ExcelReader to read a 1-dimensional set from the specified data range where the labels are found in the first data row. If you actually want to read a 3-dimensional set you would need the ExcelReader instructions to be like this:

Code: Select all

- ExcelReader:
    file: Lego-Edit.xlsx
    symbols:
        - name: testSet
          range: Hindex_new!A2:C4
          rowDimension: 3
          columnDimension: 0
          type: set
A rowDimension of 3 indicates that the first three columns of the data range will be interpreted as the labels.

Aileen
Post Reply