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



  • 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


  • Qt Champions 2016

    @AmrCoder

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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.