Hello I have been trying for awhile using the instructions given from excel to gams on a MacBook.
examples of codes below:
$onEmbeddedCode Connect:
- ExcelReader:
file: test.xlsx
symbols:
- name: elastc
range: sheet5!A1
rowDimension: 1
columnDimension: 1
- name: Elastva
range: sheet!A1
columnDimension: 0
- name: Elastx
range: acelastx!A1
columnDimension: 0
- name: ELASTY
range: sheet1!A1
rowDimension: 1
columnDimension: 1
- name: Elastmu
range: friscelast!A1
rowDimension: 1
columnDimension: 1
- GAMSWriter:
writeAll: True
$offEmbeddedCode
$onEmbeddedCode Connect:
- ExcelReader:
file: test.xlsx
symbols:
- name: Elastnw
range: sheet2!A1
rowDimension: 2
columnDimension: 0
- GAMSWriter:
writeAll: True
$offEmbeddedCode
$onEmbeddedCode Connect:
- ExcelReader:
file: test.xlsx
symbols:
- name: agg
range: sheet4!A1
rowDimension: 1
columnDimension: 1
- GAMSWriter:
writeAll: True
$offEmbeddedCode
the code seem to be correct but I am unable to see the parameters/set when I tried to display. I am seeing them but there is nothing in displayed.
Thanks for you help!!!
Data exchange from excel to gams (on macOS)
Re: Data exchange from excel to gams (on macOS)
- Attachments
-
- Test.xlsx
- (17.61 KiB) Downloaded 79 times
Data exchange from excel to gams (on macOS)
Hello I have been trying for awhile using the instructions given from excel to gams on a MacBook.
examples of codes below:
$onEmbeddedCode Connect:
- ExcelReader:
file: test.xlsx
symbols:
- name: elastc
range: sheet5!A1
rowDimension: 1
columnDimension: 1
- name: Elastva
range: sheet!A1
columnDimension: 0
- name: Elastx
range: acelastx!A1
columnDimension: 0
- name: ELASTY
range: sheet1!A1
rowDimension: 1
columnDimension: 1
- name: Elastmu
range: friscelast!A1
rowDimension: 1
columnDimension: 1
- GAMSWriter:
writeAll: True
$offEmbeddedCode
$onEmbeddedCode Connect:
- ExcelReader:
file: test.xlsx
symbols:
- name: Elastnw
range: sheet2!A1
rowDimension: 2
columnDimension: 0
- GAMSWriter:
writeAll: True
$offEmbeddedCode
$onEmbeddedCode Connect:
- ExcelReader:
file: test.xlsx
symbols:
- name: agg
range: sheet4!A1
rowDimension: 1
columnDimension: 1
- GAMSWriter:
writeAll: True
$offEmbeddedCode
the code seem to be correct but I am unable to see the parameters/set when I tried to display. I am seeing them but there is nothing in displayed.
Thanks for you help!!!
examples of codes below:
$onEmbeddedCode Connect:
- ExcelReader:
file: test.xlsx
symbols:
- name: elastc
range: sheet5!A1
rowDimension: 1
columnDimension: 1
- name: Elastva
range: sheet!A1
columnDimension: 0
- name: Elastx
range: acelastx!A1
columnDimension: 0
- name: ELASTY
range: sheet1!A1
rowDimension: 1
columnDimension: 1
- name: Elastmu
range: friscelast!A1
rowDimension: 1
columnDimension: 1
- GAMSWriter:
writeAll: True
$offEmbeddedCode
$onEmbeddedCode Connect:
- ExcelReader:
file: test.xlsx
symbols:
- name: Elastnw
range: sheet2!A1
rowDimension: 2
columnDimension: 0
- GAMSWriter:
writeAll: True
$offEmbeddedCode
$onEmbeddedCode Connect:
- ExcelReader:
file: test.xlsx
symbols:
- name: agg
range: sheet4!A1
rowDimension: 1
columnDimension: 1
- GAMSWriter:
writeAll: True
$offEmbeddedCode
the code seem to be correct but I am unable to see the parameters/set when I tried to display. I am seeing them but there is nothing in displayed.
Thanks for you help!!!
Hello
I am new to GAMS and I am trying to import an excel workbook in GAMS on a MacBook. can I get some help please. I have been using Pandas Reader.
stg1_data.xlsx
I am new to GAMS and I am trying to import an excel workbook in GAMS on a MacBook. can I get some help please. I have been using Pandas Reader.
stg1_data.xlsx
Re: Data exchange from excel to gams (on macOS)
Hi,
Your Connect code fails since the symbols Elastva, Elastx, and Elastmu want to read from the worksheets sheet, acelastx, and friscelast which do not exist in the attached Excel file. If I remove those entries from the Connect instructions, I can see data for the other symbols - e.g. elastc. The parameter agg is still empty which is due to the actual data in sheet4 which does not really contain anything suited for a two dimensional parameter. Here is my code that reads the four possible parameters:
Also for Elastnw you might want to adjust the range to sheet2!A2, but the ExcelReader will drop the first row for you automatically anyways.
Best,
Clemens
Your Connect code fails since the symbols Elastva, Elastx, and Elastmu want to read from the worksheets sheet, acelastx, and friscelast which do not exist in the attached Excel file. If I remove those entries from the Connect instructions, I can see data for the other symbols - e.g. elastc. The parameter agg is still empty which is due to the actual data in sheet4 which does not really contain anything suited for a two dimensional parameter. Here is my code that reads the four possible parameters:
Code: Select all
parameter elastc(*,*);
parameter ELASTY(*,*);
parameter Elastnw(*,*);
parameter agg(*,*);
$onEmbeddedCode Connect:
- ExcelReader:
file: test.xlsx
symbols:
- name: elastc
range: sheet5!A1
rowDimension: 1
columnDimension: 1
- name: ELASTY
range: sheet1!A1
rowDimension: 1
columnDimension: 1
- GAMSWriter:
writeAll: True
$offEmbeddedCode
$onEmbeddedCode Connect:
- ExcelReader:
file: test.xlsx
symbols:
- name: Elastnw
range: sheet2!A1
rowDimension: 2
columnDimension: 0
- GAMSWriter:
writeAll: True
$offEmbeddedCode
$onEmbeddedCode Connect:
- ExcelReader:
file: test.xlsx
symbols:
- name: agg
range: sheet4!A1
rowDimension: 1
columnDimension: 1
- GAMSWriter:
writeAll: True
$offEmbeddedCode
display elastc, ELASTY, Elastnw, agg
Best,
Clemens
Re: Data exchange from excel to gams (on macOS)
I thank you so much. this really helped
Hello
I am new to GAMS and I am trying to import an excel workbook in GAMS on a MacBook. can I get some help please. I have been using Pandas Reader.
stg1_data.xlsx
I am new to GAMS and I am trying to import an excel workbook in GAMS on a MacBook. can I get some help please. I have been using Pandas Reader.
stg1_data.xlsx