Hello I am having some trouble reading tables from Excel.Every time I try to access some data I obtain the following error message from AMPL:Error reading table TestTable with table handler odbc:Cannot open file Book1.xlsx for table TestTablewhere Book1.xlsx is an excel file with a unique column containing "N" in its first cell and containing integers in the cells bellow. My run file is:reset;model TestModel.mod;table TestTable IN "ODBC" "Book1.xlsx": N <- [N];read table TestTable;display N;solve;I use AMPL 64-bit as well as Excel 2010 64-bit on a Windows 8 machine (I have ampltabl_64.dll in my ampl folder).Thank your for your help,-David.--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at http://groups.google.com/group/ampl?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Hi Victor,Thanks for your answer, indeed the path was missing, however I still have a problem reading the file. After adding the correct path to Book1.xlsx in my run filetable TestTable IN "ODBC" "C:\...\Book1.xlsx": N <- [N];the error message has switch to:
Error reading table TestTable with table handler odbc:
Table `TestTable` does not appear in "C:\...\Book1.xlsx".Thanks again,-David
Hi Victor,Thank you for your prompt reply, indeed I was missing named ranges in Excel: I wrongly assumed that named ranges were columns names, instead of being a specific Excel feature.I can now read most of my data in Excel, but I am having some difficulty reading matrices. I would like to read an asymmetric travel time matrix between pairs of nodes in a transportation network. If I have 4 nodes in my network, the matrix in my Excel file looks like:N 1 2 3 41 t11 t12 t13 t142 t21 t22 t23 t243 t31 t32 t33 t344 t41 t42 t43 t44I have tried to use the following command line in my run file -which I found on this forum-table cost IN "ODBC" "C:\...\Book1.xlsx": [i~N],{j in N} <c[i,j]~(j);with the following lines in my model fileset N;param c{N,N} >=0;but it triggers a syntax error. I believe there should be a simpler syntax to read this matrix, but I couldn't find any example on the forum.
Could you help solve this last issue?Thanks,-David