Important: Please read the Qt Code of Conduct -

downloading csv-file from url to local device

  • Hello,
    by using the QNetworkAccessManager Class I am trying to download only the .csv-File from the following URL:

    I read the manual, but I am currently reading the whole URL and cannot find out how to download the .csv-file

    void Download::downloading()
        manager = new QNetworkAccessManager(this);
        connect(manager, SIGNAL(finished(QNetworkReply*)),
                   this, SLOT(replyFinished(QNetworkReply*)));
    void Download::replyFinished(QNetworkReply *reply)
               qDebug() << "ERROR!";
               qDebug() << reply->errorString();
               QFile *file = new QFile("/somePath/file.csv");
               delete file;

  • @Chaki
    You can't do it like that! The icons to download, which I presume is what you are looking at, don't have URLs identifying the actual document, as you discover by right-clicking on them. So I assume the click action is handled in in-page JavaScript, and you'll have to go investigate that to see what it does. Start with a View Source of the page, and do some judicious searching.

  • @JonB Thank you very much for clarifying Sir!

  • Notice that this link looks like a generated number so the link will most likely expire. This is an indicator that they don't want you to download it programmatically. Contact the owner of the website to find out if they can provide a permanent link to the file so that you can download programmatically. They may or may not provide this. They may have a policy against site scraping. Or they might direct you to an ftp or something similar.

  • Thanks for your answer, the download-link is created each with a unique, which expires after the first download itself

  • @fcarney said in downloading csv-file from url to local device:

    go to download history in browser

    That's cheating ;-) I got blob: What is that blob: protocol?

Log in to reply