Problem exporting to a .xlsx file

490 views
Skip to first unread message

Miguel A R

unread,
Jun 18, 2018, 1:19:48 PM6/18/18
to AMPL Modeling Language
Hi guys 

I want to export a three dimension variable.

I tried the following: 



table exporta OUT "tableproxy" "odbc" "evacuation.xlsx":
[nodos_filas,nodos_columnas,tiempo],x;
solve;
write table exporta;


I tried too:

table exporta OUT  "odbc" "evacuation.xlsx":
[nodos_filas,nodos_columnas,tiempo],x;
solve;
write table exporta;

Excel is created  in both cases but i can not open the excel Neverthless if i put xls instead xlsx i can open excel so doesnt work with xlsx?


Thanks and Regards

AMPL Google Group

unread,
Jun 18, 2018, 7:41:33 PM6/18/18
to Ampl Modeling Language
Could you please try adding the option "verbose=1" to your table declaration as follows and send us the additional output shown?

table exporta OUT "tableproxy" "odbc" "evacuation.xlsx" "verbose=1": ...

As this may be a limitation of the ODBC driver for Excel that you have installed. You should also check the ODBC drivers that you have installed by running odbcad32.exe. Under the tab drivers there should be one similar to the following: "Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb);".

--
Filipe Brandão
am...@googlegroups.com
{#HS:603513613-11125#}
--
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 https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.



Miguel A R

unread,
Jun 18, 2018, 10:14:33 PM6/18/18
to AMPL Modeling Language

Applying verbose =1, i get the following:


ampl: include try.run;
_ampl_elapsed_time + _total_solve_elapsed_time = 0

CPLEX 12.7.1.0: optimal integer solution; objective 181057.8932
168 MIP simplex iterations
0 branch-and-bound nodes
No basis.
AMPL ODBC driver, version 20151130.
ODBC drivers...
"Driver da Microsoft para arquivos texto (*.txt; *.csv)" for *.,*.asc,*.csv,*.tab,*.txt,*.csv
"Driver do Microsoft Access (*.mdb)" for *.mdb
"Driver do Microsoft dBase (*.dbf)" for *.dbf,*.ndx,*.mdx
"Driver do Microsoft Excel(*.xls)" for *.xls
"Driver do Microsoft Paradox (*.db )" for *.db
"Microsoft Access Driver (*.mdb)" for *.mdb
"Microsoft Access-Treiber (*.mdb)" for *.mdb
"Microsoft dBase Driver (*.dbf)" for *.dbf,*.ndx,*.mdx
"Microsoft dBase-Treiber (*.dbf)" for *.dbf,*.ndx,*.mdx
"Microsoft Excel Driver (*.xls)" for *.xls
"Microsoft Excel-Treiber (*.xls)" for *.xls
"Microsoft ODBC for Oracle" -- no associated extensions.
"Microsoft Paradox Driver (*.db )" for *.db
"Microsoft Paradox-Treiber (*.db )" for *.db
"Microsoft Text Driver (*.txt; *.csv)" for *.,*.asc,*.csv,*.tab,*.txt,*.csv
"Microsoft Text-Treiber (*.txt; *.csv)" for *.,*.asc,*.csv,*.tab,*.txt,*.csv
"SQL Server" -- no associated extensions.
"Microsoft Access Driver (*.mdb, *.accdb)" for *.mdb,*.accdb
"Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)" for *.xls,*.xlsx, *.xlsb
"Microsoft Access Text Driver (*.txt, *.csv)" for *.txt, *.csv
"SQL Server Native Client 10.0" -- no associated extensions.
"ODBC Driver 13 for SQL Server" -- no associated extensions.
Calling SQLDriverConnect("DSN=Excel Files;DBQ=C:\Users\xp\Downloads\amplide.mswin64\amplide\evacuation.xlsx")
Connection string: "DSN=Excel Files;DBQ=C:\Users\xp\Downloads\amplide.mswin64\amplide\evacuation.xlsx;DriverId=1046;MaxBufferSize=2048;PageTimeout=5;"
ampl: 

AMPL Google Group

unread,
Jun 19, 2018, 11:19:03 AM6/19/18
to Ampl Modeling Language
Could you please try with each of the following table declarations that specify the driver to be used?

table exporta OUT "tableproxy" "odbc" "Driver=Microsoft Excel Driver (*.xls, *.xlsx,
*.xlsm, *.xlsb);ReadOnly=0;DBQ=evacuation.xlsx" "verbose=1": ...

or

table exporta OUT "odbc" "Driver=Microsoft Excel Driver (*.xls, *.xlsx,
*.xlsm, *.xlsb);ReadOnly=0;DBQ=evacuation.xlsx" "verbose=1": ...

--
Filipe Brandão
am...@googlegroups.com
{#HS:603513613-11125#}
On Mon, Jun 18, 2018 at 11:41 PM UTC, AMPL Google Group <am...@googlegroups.com> wrote:
Could you please try adding the option "verbose=1" to your table declaration as follows and send us the additional output shown?

table exporta OUT "tableproxy" "odbc" "evacuation.xlsx" "verbose=1": ...

As this may be a limitation of the ODBC driver for Excel that you have installed. You should also check the ODBC drivers that you have installed by running odbcad32.exe. Under the tab drivers there should be one similar to the following: "Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb);".

--
Filipe Brandão
am...@googlegroups.com


On Mon, Jun 18, 2018 at 5:20 PM UTC, Ampl Modeling Language <am...@googlegroups.com> wrote:
Hi guys

I want to export a three dimension variable.

I tried the following:



table exporta OUT "tableproxy" "odbc" "evacuation.xlsx":
[nodos_filas,nodos_columnas,tiempo],x;
solve;
write table exporta;


I tried too:

table exporta OUT "odbc" "evacuation.xlsx":
[nodos_filas,nodos_columnas,tiempo],x;
solve;
write table exporta;

Excel is created in both cases but i can not open the excel Neverthless if i put xls instead xlsx i can open excel so doesnt work with xlsx?


Thanks and Regards

Miguel A R

unread,
Jun 19, 2018, 11:53:00 AM6/19/18
to AMPL Modeling Language
i tried your proposal and i get the following:



CPLEX 12.7.1.0: optimal integer solution; objective 181057.8932
168 MIP simplex iterations
0 branch-and-bound nodes
No basis.
AMPL ODBC driver, version 20151130.
Connection string: "DBQ=evacuation.xlsx;DefaultDir=.;Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DriverId=1046;MaxBufferSize=2048;PageTimeout=5;ReadOnly=0;"

any file was created

El lunes, 18 de junio de 2018, 12:19:48 (UTC-5), Miguel A R escribió:

AMPL Google Group

unread,
Jun 20, 2018, 11:54:27 AM6/20/18
to Ampl Modeling Language
Could you please send us one of these .xlsx files which cannot be opened?

A possible solution may require updating the ODBC drivers by installing Microsoft Access Database Engine 2016 (https://www.microsoft.com/en-us/download/details.aspx?id=54920&751be11f-ede8-5a0c-058c-2ee190a24fa6=True).

--
Filipe Brandão
am...@googlegroups.com
{#HS:603513613-11125#}
On Tue, Jun 19, 2018 at 3:53 PM UTC, Ampl Modeling Language <am...@googlegroups.com> wrote:
i tried your proposal and i get the following:


CPLEX 12.7.1.0: optimal integer solution; objective 181057.8932
168 MIP simplex iterations
0 branch-and-bound nodes
No basis.
AMPL ODBC driver, version 20151130.
Connection string: "DBQ=evacuation.xlsx;DefaultDir=.;Driver={Microsoft
Excel Driver (*.xls, *.xlsx, *.xlsm,
*.xlsb)};DriverId=1046;MaxBufferSize=2048;PageTimeout=5;ReadOnly=0;"

any file was created



On Tue, Jun 19, 2018 at 3:18 PM UTC, AMPL Google Group <am...@googlegroups.com> wrote:
Could you please try with each of the following table declarations that specify the driver to be used?

table exporta OUT "tableproxy" "odbc" "Driver=Microsoft Excel Driver (*.xls, *.xlsx,
*.xlsm, *.xlsb);ReadOnly=0;DBQ=evacuation.xlsx" "verbose=1": ...

or

table exporta OUT "odbc" "Driver=Microsoft Excel Driver (*.xls, *.xlsx,
*.xlsm, *.xlsb);ReadOnly=0;DBQ=evacuation.xlsx" "verbose=1": ...

--
Filipe Brandão
am...@googlegroups.com


On Tue, Jun 19, 2018 at 2:14 AM UTC, Ampl Modeling Language <am...@googlegroups.com> wrote:
Applying verbose =1, i get the following:


ampl: include try.run;
_ampl_elapsed_time + _total_solve_elapsed_time = 0

CPLEX 12.7.1.0: optimal integer solution; objective 181057.8932
168 MIP simplex iterations
0 branch-and-bound nodes
No basis.
AMPL ODBC driver, version 20151130.
Hi guys

I want to export a three dimension variable.

I tried the following:



table exporta OUT "tableproxy" "odbc" "evacuation.xlsx":
[nodos_filas,nodos_columnas,tiempo],x;
solve;
write table exporta;


I tried too:

table exporta OUT "odbc" "evacuation.xlsx":
[nodos_filas,nodos_columnas,tiempo],x;
solve;
write table exporta;

Excel is created in both cases but i can not open the excel Neverthless if i put xls instead xlsx i can open excel so doesnt work with xlsx?


Thanks and Regards

Miguel A R

unread,
Jun 20, 2018, 5:44:15 PM6/20/18
to am...@googlegroups.com
Hello

I am sending the file and the screenshot that pop-up when i tried to open it.



Thanks and Regards
Miguel Ángel

To unsubscribe from this group and stop receiving emails from it, send an email to ampl+unsubscribe@googlegroups.com.

To post to this group, send email to am...@googlegroups.com.
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.



--
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+unsubscribe@googlegroups.com.
evacuation.xlsx

AMPL Google Group

unread,
Jun 20, 2018, 6:42:48 PM6/20/18
to Ampl Modeling Language
The file is a valid .xls file and not a .xlsx file. This problem seems very similar to the following: https://social.msdn.microsoft.com/Forums/en-US/cb45a5ca-2919-4c51-8e06-62621bfbfacc/odbc-driver-issue-for-xlsx-files-in-the-microsoft-excel-driver-xls-xlsx-xlsm-xlsb-odbc?forum=innovateonoffice

Have you tried installing Microsoft Access Database Engine 2016?

--
Filipe Brandão
am...@googlegroups.com
{#HS:603513613-11125#}
On Wed, Jun 20, 2018 at 9:44 PM UTC, Ampl Modeling Language <am...@googlegroups.com> wrote:
Hello

I am sending the file and the screenshot that pop-up when i tried to open it.

ii_jinn8h9v0_1641f2622713a34c


Thanks and Regards
Miguel Ángel



On Wed, Jun 20, 2018 at 3:53 PM UTC, AMPL Google Group <am...@googlegroups.com> wrote:
Could you please send us one of these .xlsx files which cannot be opened?

A possible solution may require updating the ODBC drivers by installing Microsoft Access Database Engine 2016 (https://www.microsoft.com/en-us/download/details.aspx?id=54920&751be11f-ede8-5a0c-058c-2ee190a24fa6=True).

--
Filipe Brandão
am...@googlegroups.com


Reply all
Reply to author
Forward
0 new messages