Re: Issue with reading from Excel

"Heinrich Schuchardt" <[email protected]>
Newsgroups gmane.comp.gnu.glpk
Message-ID <trinity-575995ba-353c-4b4b-83bb-719d63514915-1575907140438@msvc-mesg-gmx024>
Hello Marc,

which driver are you using?

Your current directory is assumed to be examples\sql.
Did you cd to that directory?

Best regards

Heinrich Schuchardt

http://www.xypron.de

Am 09.12.19 um 16:23 schrieb Meketon, Marc\ via \Users list for GLPK (GNU Linear Programming Kit)

> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.