Qt & Excel xlsx outputs
-
@Christian-Ehrlicher thank you for your help.
I got the following screen but I don't understang how I could configure the Excel driver there.
I also tried to compile my program with MinGw 32 bit : the error remain unchanged.
-
Thank you for your help.
I worked ! Sticking with exactly the same spaces to the same places. And with 32 bits compiler.
I tried to change to 64 bit compiler : KO. I tried with a very long and weird file name : it works.
Driver and dbq can be write : DRIVER, DBQ, driver, dbq, Driver, Dbq.Here is the current working code :
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC"); QString connectionString("DRIVER={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + QString("D:\\sabin\\Documents\\C++ et C\\C++\\BaF\\BaF\\Templates\\TEST.xls")); db.setDatabaseName(connectionString); if(db.open()) { QSqlQuery query("select * from [" + QString("Infos_adm") + "$A1:E20]"); while (query.next()) { //reading columns QString column1= query.value(0).toString(); qDebug()<<column1; } qDebug()<<"done"; db.close(); QString dbConnectionName(db.connectionName()); db.~QSqlDatabase(); QSqlDatabase::removeDatabase(dbConnectionName); } else { qDebug()<<db.lastError(); qDebug() << connectionString ; }
-
@Touchoco said in Qt & Excel xlsx outputs:
And with 32 bits compiler.
I tried to change to 64 bit compiler : KOSo my idea was wrong. Install a 64 Bit Excel if you want to use a 64Bit Qt (sad but true).
-
@Touchoco
Glad it works, but it's a shame to have to change over to 32-bit Qt app just to be able to talk ODBC to Excel.If you want to pursue this further I think it is a non-Qt issue. You would have to Google for something about how to ODBC from a 64-bit executable when I have such-and-such (probably 32-bit) Excel, or similar.