Hello forum,
I have excel file with this pattern:
Qt Code:
  1. ID #1 #2 #3
  2. NAME A B C
  3. #1 A x
  4. #2 B x
  5. #3 C x
To copy to clipboard, switch view to plain text mode 
"X" means that the row belongs to the column.
Qt Code:
  1. QString path = fileName;
  2. sheet = nullptr;
  3. sheets = nullptr;
  4. workbook = nullptr;
  5. workbooks = nullptr;
  6. excelApplication = nullptr;
  7.  
  8. if(path == "")
  9. {
  10. qDebug() << "'fileName' is empty!";
  11. return;
  12. }
  13. path.replace("/", "\\");
  14.  
  15. excelApplication = new QAxObject( "Excel.Application", 0 );
  16.  
  17. if (excelApplication == nullptr)
  18. throw invalid_argument("Failed to initialize interop with Excel (probably Excel is not installed)");
  19.  
  20. excelApplication->dynamicCall( "SetVisible(bool)", false ); // hide excel
  21. excelApplication->setProperty( "DisplayAlerts", 0); // disable alerts
  22.  
  23. workbooks = excelApplication->querySubObject( "Workbooks" );
  24. workbook = workbooks->querySubObject( "Open(const QString&)", path );
  25. sheets = workbook->querySubObject( "Worksheets" );
  26.  
  27. ...
  28. ...
  29.  
  30. for(int i=0; i<rowsCnt; ;++i)
  31. for(int j=0; j<colsCnt; ;++j)
  32. {
  33. QAxObject* cell = sheet->querySubObject( "Cells( int, int )", i, j);
  34. QVariant value = cell->dynamicCall( "Value()" );
  35. dataRow.append(value);
  36. }
To copy to clipboard, switch view to plain text mode 
It works fine, but the execution time is slow, especially at a larger table (200x200 or more).

My question is if exist faster way to read excel file.

Thanks for any advice!