You defined “set Jn {N} within J;” so you need to write
table listaGeneradoresaN {n in N} IN "amplxl" "Pruebadat.xlsx" "Generadores": Jn[n] <- [Jn];
However, this will give you all the same members in every set Jn[1], Jn[2], etc.:
ampl: display Jn;
set Jn[1] :=
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32;
set Jn[2] :=
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32;
set Jn[3] :=
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32;
Is that what you want?
You can try a similar modification to listaOrigenaristas,
table listaOrigenaristas {(o,d) in L} IN "amplxl" "Pruebadat.xlsx" "Aristas": Ol[o,d] <- [Ol];
but you will get this error message:
Error reading table listaOrigenaristas[1,2] with table handler amplxl:
AddRows: duplicate subscript [1]
That is because the number 1 is repeated several times in column Ol of the spreadsheet, but a number can appear only once in a set. Instead of trying to read the Ol sets from the spreadsheet, you can define them in the model; replace “set Ol {L} within N;” by
set Ol {L} = setof {(o,d) in L} o;
(and remove the references to table listaOrigenaristas in your data file). However, this will assign all the same members to Ol[1,2], Ol[1,3], Ol[1,5], Ol[2,4], etc. – and I am not sure that is what you want.