help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Issue with reading from Excel


From: Meketon, Marc
Subject: Issue with reading from Excel
Date: Mon, 9 Dec 2019 15:23:27 +0000

Hello GLPK’ers

I’m trying to use GMPL to read from Excel.  Below is essentially from the 
Sudok_excel.mod example found in the distribution, but where I updated it with 
a later driver:

set fields dimen 2;
param givens{1..9, 1..9}, integer, >= 0, <= 9, default 0;
/* the "givens" */

table ti IN 'ODBC'
  'DRIVER={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};'
  'dbq=C:\glpk_463\examples\sql\sudoku.xlsx'
  'SELECT ID, COL, LIN, VAL FROM [Sudoku$] '
  'WHERE ID = 1' :
  fields <- [COL, LIN], givens ~ VAL;

end;

==>When I run this, two problems occur, and help would be appreciated:
==>  1.  A window pops up asking me which Excel file to use.  Is there a way to 
eliminate it?
==>  2.  I get the error below.  This is really important to solve.  I have 
tried both named ranges for the Excel data, and worksheet names (that end with 
a $).

GLPSOL: GLPK LP/MIP Solver, v4.57
Parameter(s) specified in the command line:
 --cover --clique --gomory --mir -m sudoku_excel.mod
Reading model section from sudoku_excel.mod...
12 lines were read
Reading ti...
Connected to EXCEL 12.00.0000 - C:\glpk_463\examples\sql\sudoku.xlsx
SELECT COL, LIN, VAL FROM WHERE ID = 1
db_iodbc_open: Query
"SELECT COL, LIN, VAL FROM WHERE ID = 1"
failed.

The driver reported the following diagnostics whilst running SQLExecDirect
42000:1:-3506:[Microsoft][ODBC Excel Driver] Syntax error in FROM clause.
sudoku_excel.mod:5: error on opening table ti
MathProg model processing error

reply via email to

[Prev in Thread] Current Thread [Next in Thread]