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

**URL:** <https://discuss.ampl.com/t/ampl-24447-error-reading-table-deiks-with-table-handler-amplxl-cannot-extract-workbook/303>\
**Category:** Google Group Mirror\
**Created:** [January 6, 2023, 8:45pm UTC](https://discuss.ampl.com/t/ampl-24447-error-reading-table-deiks-with-table-handler-amplxl-cannot-extract-workbook/303 "2023-01-06T20:45:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Laura\_Soto](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/laura_soto/32/126_2.png) [@Laura\_Soto](https://discuss.ampl.com/u/Laura_Soto)\
**Post date:** [January 6, 2023, 8:45pm UTC](https://discuss.ampl.com/t/ampl-24447-error-reading-table-deiks-with-table-handler-amplxl-cannot-extract-workbook/303/1 "2023-01-06T20:45:40Z")

</div>

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](https://discuss.ampl.com/uploads/short-url/hvM3JawnOlYGRSKugtqHbMCyqLU.run) (853 Bytes)

---

<div class="post-metadata">

**Author:** ![AMPL\_Google\_Group](https://avatars.discourse-cdn.com/v4/letter/a/9dc877/32.png) [@AMPL\_Google\_Group](https://discuss.ampl.com/u/AMPL_Google_Group)\
**Post date:** [January 6, 2023, 10:12pm UTC](https://discuss.ampl.com/t/ampl-24447-error-reading-table-deiks-with-table-handler-amplxl-cannot-extract-workbook/303/2 "2023-01-06T22:12:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Laura\_Soto](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/laura_soto/32/126_2.png) [@Laura\_Soto](https://discuss.ampl.com/u/Laura_Soto)\
**Post date:** [January 6, 2023, 10:33pm UTC](https://discuss.ampl.com/t/ampl-24447-error-reading-table-deiks-with-table-handler-amplxl-cannot-extract-workbook/303/3 "2023-01-06T22:33:02Z")

</div>

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

 ![Error2.png](https://us1.discourse-cdn.com/flex019/uploads/ampl/original/1X/aa29c18563fa5b6a6b8a8ef4d47721ef55d5b9dd.png)

What do you recommend to solve it?

---

<div class="post-metadata">

**Author:** ![Laura\_Soto](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/laura_soto/32/126_2.png) [@Laura\_Soto](https://discuss.ampl.com/u/Laura_Soto)\
**Post date:** [January 6, 2023, 9:04pm UTC](https://discuss.ampl.com/t/ampl-24447-error-reading-table-deiks-with-table-handler-amplxl-cannot-extract-workbook/303/4 "2023-01-06T21:04:03Z")

</div>

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](https://discuss.ampl.com/uploads/short-url/c74613hQ1FF13ieMqnTxZxFbOWD.run) (892 Bytes)

> **[datos\_deiks\_.xlsx](https://docs.google.com/spreadsheets/d/1IOkD_pgsEnPLtn6HVB5VuYILCBanyp8L/edit?usp=sharing&ouid=101091829336513510834&rtpof=true&sd=true)**
>
> deiks
> 
> K
> I,S,E,20\_DE\_JULIO,7\_DE\_ABRIL\_I,7\_DE\_ABRIL\_II,7\_DE\_ABRIL\_LAS\_GRANJAS,ABAJO\_I,ABAJO\_II,AGRECON,ALFONSO\_LOPEZ,ALTOS\_DEL\_PRADOI,ALTOS\_DEL\_PRADO\_II,ALTOS\_RIOMAR\_ALTOS\_LIMON,ALTOS\_RIOMAR\_STA\_MONICA,ANDALUCIA\_VILLA\_DEL\_ESTE,ATLANTICO,BARLOVENTO,BAT...

---

<div class="post-metadata">

**Author:** ![AMPL\_Google\_Group](https://avatars.discourse-cdn.com/v4/letter/a/9dc877/32.png) [@AMPL\_Google\_Group](https://discuss.ampl.com/u/AMPL_Google_Group)\
**Post date:** [January 9, 2023, 3:09am UTC](https://discuss.ampl.com/t/ampl-24447-error-reading-table-deiks-with-table-handler-amplxl-cannot-extract-workbook/303/5 "2023-01-09T03:09:51Z")

</div>

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.
