how to find a string in a excel file with qt?
-
I don't know how to do it.
-
@mohsen_yadik
you have xlsx file and want to search string from qt?
I'm sorry but I do not understand what you want. -
- I don't know how to do it.
Which part of it ?
The sample loops over cells.
All that is left is to compare string?Why did you try so far, please show some code
-
Thanks for help me.
with your guide was done.
Thank you -
@mrjj I get the following error when i run this pro QZip: not a zip file!
Any idea whats wrong here ? -
@Beemaneni-Bala-0
Hi
Can other tool open the zip file ? -
@mrjj All i have is only an excel file. I did not understand why and where zip file is needed here ?
-
@Beemaneni-Bala-0
The excel file (XLSX) is actually a zip file.
Do you try to give it an old binary format ?
what is the extension of the file? -
@mrjj Here is the code snipped . I need to just read an excel file here. i am using linux machine here and i can open excel file using libreoffice
void MainWindow::readExcelFile(QString excelSheetFile){ QXlsx::Document xlsx("ExcelSheet.xlsx"); qDebug()<<xlsx.read("A1"); qDebug()<<xlsx.read("A2"); qDebug()<<xlsx.read("A3"); qDebug()<<xlsx.read("A4"); qDebug()<<xlsx.read("A5"); qDebug()<<xlsx.read("A6"); qDebug()<<xlsx.read("A7"); for (int row=1; row<10; ++row) { qDebug()<<"Row No : "<<row << xlsx.cellAt(row, 1); if (QXlsx::Cell *cell=xlsx.cellAt(row, 1)) qDebug()<< "Cell Data: " << cell->value(); } }
-
Hi
and the file is indeed an xlsx and not the old xls `?
The file you give it, excelSheetFile
Else convert it with libreOffice -
@mrjj Thanks a lot for the information. I had renamed the file to xlsx. That was the issue. After converting using libreoffice it works and i can fetch information.