[AMPL 24447] Error reading table deiks with table handler amplxl: cannot extract workbook

Good afternoon

I have the following problem:
I need to import from excel a table that has 4 sets but I get the following error:
Error reading table deiks with table handler amplxl:
cannot extract workbook
I attach the excel file and the .run

Thank you in advance for your help

(Attachment datos_deiks_.xlsx is missing)

Prueba2.run (853 Bytes)

Usually when this error appears, the problem is that the spreadsheet file is open in Excel. You can fix it by closing datos_deiks_.xlsx before you execute Prueba2.run.

Note also that there are no “4D” tables in spreadsheets. Even though there are 4 index sets, you should specify “2D” in your “table deiks” statement.

Thank you very much for your reply.
I closed the document datos_deiks_.xlsx before executing Prueba2.run but I get the following error:

What do you recommend to solve it?

I have the following problem:
I need to import from excel a table that has 4 sets but I get the following error:
Error reading table deiks with table handler amplxl:
cannot extract workbook
I attach the link of the excel file and the .run

Thank you in advance for your help
Prueba2.run (892 Bytes)

To read the table from the spreadsheet, you are using

table deiks IN "amplxl" "datos_deiks_.xlsx" "deiks" "2D": [I,S,E,K], d_eiks;

For this to work properly, you need to define d_eiks in your model with the sets in the same order as they are in the table statement:

param d_eiks {I,S,E,K};

But the name “d_eiks” suggests that you may have instead defined this parameter with the sets in a different order: “param d_eiks {E,I,K,S}”. That would cause all of the “invalid subscript” messages that you are seeing.

To fix this, change your table statement to

table deiks IN "amplxl" "datos_deiks_.xlsx" "deiks" "2D": [E,I,K,S], d_eiks;

and then rearrange the first three columns in datos_deiks_.xlsx so that the E column comes first, then the I column, and then the S column.