Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Reading Xlsx file
Qt 6.11 is out! See what's new in the release blog

Reading Xlsx file

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 965 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dan1973
    wrote on last edited by
    #1

    Hi,

    I was trying to read sample xlsx file using Qt library QXlsx

    code below:

        Document xlsxR("Test.xlsx");
        if (xlsxR.load()) // load excel file
        {
            Cell* cell = xlsxR.cellAt(row, col); // get cell pointer.
            if ( cell != NULL )
            {
                QVariant var = cell->readValue(); // read cell value (number(double), QDateTime, QString ...)
                qDebug() << var; // display value. it is 'Hello Qt!'.
            }
        }
    

    Here, it is giving compile error as:
    c2039: 'load': is not a member of 'QXlsx::Document'

    Any help on this is appreciated.
    I need to read Xlsx using QXlsx.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dan1973
      wrote on last edited by
      #2

      HI,
      I got this solution.
      QXlsx::Document.read("A1");
      usage example:
      QVariant var1;
      Document xlsxR("Test.xlsx");
      qDebug() << "Test.xlsx - QXlsx::Document.read()";
      var1 = xlsxR.read("A1");
      qDebug() << "A1: " << var1.toString();

      JonBJ 1 Reply Last reply
      0
      • D dan1973

        HI,
        I got this solution.
        QXlsx::Document.read("A1");
        usage example:
        QVariant var1;
        Document xlsxR("Test.xlsx");
        qDebug() << "Test.xlsx - QXlsx::Document.read()";
        var1 = xlsxR.read("A1");
        qDebug() << "A1: " << var1.toString();

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #3

        @dan1973
        Well, yes, what part of Xslx documentation told you there is a Document.load() method?

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved