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. Read data from MS Excel file that have a password using QtXlsx library
Forum Updated to NodeBB v4.3 + New Features

Read data from MS Excel file that have a password using QtXlsx library

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 1.7k Views 2 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.
  • AmrCoderA Offline
    AmrCoderA Offline
    AmrCoder
    wrote on last edited by A Former User
    #1

    I'm using Qtxlsx Libary to read data from excel file found here but some of this files have a password and I have this passwords so is there any option to give this password to the library to start read the data from it?
    I use this code to read the data from the file

        using namespace QXlsx;
        QXlsx::Document xlsx("D:/Book1.xlsx");
        int row = xlsx.dimension().lastRow();
        int col = xlsx.dimension().lastColumn();
        qDebug() << "row = " << row << " " << " col = " << col;
        for (int i = 1; i <= row; i++) {
            for (int j = 1; j <= col; j++) {
                std::cout << xlsx.read(i,j).toString().toStdString() << " | ";
            }
            std::cout << std::endl;
        }
        fflush(stdout);
    

    is there something like

    xlsx.setPassword("11111");
    

    to open the excel file and start read from it because if I read the data from excel file that have a password it give me this error

    QZip: not a zip file!
    

    so is there anyway to do that or a library to give it password and return an excel file without password or any solution
    Thanks in advance

    mrjjM 1 Reply Last reply
    0
    • AmrCoderA AmrCoder

      I'm using Qtxlsx Libary to read data from excel file found here but some of this files have a password and I have this passwords so is there any option to give this password to the library to start read the data from it?
      I use this code to read the data from the file

          using namespace QXlsx;
          QXlsx::Document xlsx("D:/Book1.xlsx");
          int row = xlsx.dimension().lastRow();
          int col = xlsx.dimension().lastColumn();
          qDebug() << "row = " << row << " " << " col = " << col;
          for (int i = 1; i <= row; i++) {
              for (int j = 1; j <= col; j++) {
                  std::cout << xlsx.read(i,j).toString().toStdString() << " | ";
              }
              std::cout << std::endl;
          }
          fflush(stdout);
      

      is there something like

      xlsx.setPassword("11111");
      

      to open the excel file and start read from it because if I read the data from excel file that have a password it give me this error

      QZip: not a zip file!
      

      so is there anyway to do that or a library to give it password and return an excel file without password or any solution
      Thanks in advance

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      @AmrCoder

      Hi
      I dont think its supported
      https://github.com/dbzhang800/QtXlsxWriter/issues/121
      See VSRonin post.

      1 Reply Last reply
      2

      • Login

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