Error writing table: No suitable driver found.

820 views
Skip to first unread message

Laura Hervert

unread,
Apr 28, 2014, 5:40:28 PM4/28/14
to am...@googlegroups.com
Hi

 I have the following error messagen when trying to write the results in a excel file. It seems to read the file well.
 I already downloaded and install dll files from http://www.ampl.com/NEW/tables.html 

I hope you can help me, thanks in advance


Error at _cmdno 5 executing "write_table" command
(file x.run, line 16, offset 664):

Error writing table dietResults with table handler tableproxy:
No suitable driver found.

My code is:

model diet.mod;
table dietFoods IN "tableproxy" "ODBC" "D:.....\Downloads\diet.xls" "Foods": FOOD <- [FOOD], cost, f_min, f_max;
table dietNutrs IN "tableproxy" "ODBC" "D:.......\Downloads\diet.xls" "Nutrients": NUTR <- [NUTR], n_min, n_max;
table dietAmts IN "tableproxy" "ODBC" "D:......\Downloads\diet.xls" "Amounts": [NUTR, FOOD], amt;

read table dietFoods;
read table dietNutrs;
read table dietAmts;
                  
solve;

table dietResults OUT  "tableproxy" "ODBC" "D:\Lhervert\Documents\Downloads\new.xlsx" "Foods":
   [FOOD], cost IN, Buy, Buy.rc ~ BuyRC, {j in FOOD} Buy[j]/f_max[j] ~ BuyFrac;

write table dietResults;

victor.z...@gmail.com

unread,
Apr 28, 2014, 6:14:48 PM4/28/14
to am...@googlegroups.com
Hi Laura,

Message "No suitable driver found" means that you don't have an Excel ODBC driver that can handle *.xlsx files installed in the system. You can download one from here: http://www.microsoft.com/en-us/download/details.aspx?id=13255

HTH,
Victor


--
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.
For more options, visit https://groups.google.com/d/optout.

Laura Hervert

unread,
Apr 29, 2014, 6:08:15 PM4/29/14
to am...@googlegroups.com
Hi

You are right, but now i am getting this error:

Error at _cmdno 6 executing "write_table" command
(file x.run, line 17, offset 686):

Error writing table dietResults with table handler tableproxy:
DROP TABLE `Foods` failed.
Is another application using "D:\Lhervert\Documents\Downloads\new.xls"?

Any suggestions?

victor.z...@gmail.com

unread,
Apr 29, 2014, 6:32:10 PM4/29/14
to am...@googlegroups.com
Hi Laura,

You can add option "verbose=1" to the table declaration to get verbose error message:

   table T "ODBC" "test.xls" 'verbose=1': ...

Most likely the problem is in read-only attribute which seems to be the default in some versions of MS ODBC driver for Excel. This is indicated by the following verbose error message:

errmsg = "[Microsoft][ODBC Excel Driver] Cannot modify the design of table 'T'.
 It is in a read-only database."

You can set the read-only attribute to false in a data source. Either create one with ODBC Administrator or manually create a file with extension .dsn, say test.dsn, and the following content:

[ODBC]
DRIVER=Microsoft Excel Driver (*.xls)
ReadOnly=0
DBQ=test.xls

You might need to change "Microsoft Excel Driver (*.xls)" to the name of the Excel ODBC driver installed on your machine and test.xls to the path of your Excel file.

Then you can use this data source in the table declaration instead of the path to .xls file:

  table T "ODBC" "test.dsn": ...

HTH,
Victor
Reply all
Reply to author
Forward
0 new messages