QAxObject and Excel
-
@LeLev
Okay i will Restore The Post
Sorry To Say But What Is Meaning Of
@LeLev said in QAxObject and Excel:
OP
?@Ketan__Patel__0011
I didn't see you had actually deleted your useful post! Yes, please do restore it!OP == "Original Poster", the person who starts a thread.
-
@LeLev
Okay i will Restore The Post
Sorry To Say But What Is Meaning Of
@LeLev said in QAxObject and Excel:
OP
?@Ketan__Patel__0011 the person who created this thread, (Original Poster )
-
@Ketan__Patel__0011 the person who created this thread, (Original Poster )
@LeLev
Okay i got it Thank You
-
@Ketan__Patel__0011
I didn't see you had actually deleted your useful post! Yes, please do restore it!OP == "Original Poster", the person who starts a thread.
I Restored it
-
If you want to read any excel file then use
QSqlDatabase
For Itmy personal experience saying that
QAxObject
take Lot's of time for read any kind of Excel file
AndQAxObject
Very complicated Conceptyou can see my code for Read Any Kind Of Excel File
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC", "xlsx_connection"); db.setDatabaseName("DRIVER={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + QString(FilePath) + ""); if(db.open()) qDebug() << "Excel Is Connected"; else qDebug() << "Excel Is Not Connected"; QSqlQuery query(db); query.prepare("SELECT * FROM [" + QString("Sheet1") + "$]"); // Select range, place A1:B5 after $ if(query.exec()) { while (query.next()) { ///// Your Code } }
for this You must have to Install Mysql Driver For Excel
@Ketan__Patel__0011 I agree with you. AxObject is very slow especially in Save Data.
-
@Ketan__Patel__0011 I agree with you. AxObject is very slow especially in Save Data.
Happy To Help
-
Is it possible to get the cell's address using SQL/ODBC? I can get the column easily from
QSqlQuery::value
but how to obtain the row's number?
-
@Koru I don't follow, could you give an example of what query you issue, how you get a column number and what you want to get for a row number?
@JonB, the query is actually irrelevant, I just need to get the cell's address. I have an application that validates columns and lists cells that have wrong values. The validation result is the address and a failure message so the user knows exactly where the error occurs and what has to be fixed directly in a checked file.
SQL/ODBC queries compare columns faster than QAxObjects, but results lack addresses. The addresses don't have to be in an Excel manner like A12 etc., it can be a row/column number from the sheet.