# Error reading table NodosDesde with table handler amplxl: 	AddRows: duplicate subscript \['n1'\]

**URL:** https://discuss.ampl.com/t/error-reading-table-nodosdesde-with-table-handler-amplxl-addrows-duplicate-subscript-n1/1198
**Category:** Support
**Tags:** errors-and-messages
**Created:** [September 6, 2024, 3:49pm UTC](https://discuss.ampl.com/t/error-reading-table-nodosdesde-with-table-handler-amplxl-addrows-duplicate-subscript-n1/1198 "2024-09-06T15:49:50Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Laura\_Rodriguez](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/laura_rodriguez/32/831_2.png) [@Laura\_Rodriguez](https://discuss.ampl.com/u/Laura_Rodriguez)
#### Post date: [September 6, 2024, 3:49pm UTC](https://discuss.ampl.com/t/error-reading-table-nodosdesde-with-table-handler-amplxl-addrows-duplicate-subscript-n1/1198/1 "2024-09-06T15:49:50Z")

</div>

Hello everyone,

Im trying to read data from Excel in Ampl and I’m facing this error: “Error reading table NodosDesde with table handler amplxl:  
AddRows: duplicate subscript [‘n1’]”

**This is what im trying to read:**

#------------------------------------------------------------------------------

table NodosDesde IN “amplxl” “sistema1.xlsx” “lin”:  
FROM ← [FROM];

table NodosHasta IN “amplxl” “sistema1.xlsx” “lin”:  
TO ← [TO];

read table NodosDesde;  
read table NodosHasta;  
let B := FROM union TO;

this is my spreadsheet “lin”

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

Hope someone can help me 🙂

---

<div class="post-metadata">

### Author: ![4er](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/4er/32/530_2.png) [@4er](https://discuss.ampl.com/u/4er)
#### Post date: [September 7, 2024, 12:41am UTC](https://discuss.ampl.com/t/error-reading-table-nodosdesde-with-table-handler-amplxl-addrows-duplicate-subscript-n1/1198/2 "2024-09-07T00:41:02Z")

</div>

You are seeing the `duplicate` `subscript` `['n1']` error becuase `n1` appears more than once in the `FROM` column. There will be the same problem with the `TO` column.

It appears however that the pair of `FROM` and `TO` nodes in each row of the spreadsheet is unique. So, you can read the set of pairs from the spreadsheet, and use that to define the `FROM` and `TO` sets. For example:

```auto
set ARCS dimen 2;

table Arcs IN "amplxl" "..\sistema1.xlsx" "pairs":
   ARCS <- [FROM,TO];
read table Arcs;

set FROM = setof {(i,j) in ARCS} i;
set TO = setof {(i,j) in ARCS} j;

set B = FROM union TO;

```

Here the range `pairs` should include both the `FROM` and `TO` columns of the spreadsheet.
