Forum Discussion

anupambit1797's avatar
anupambit1797
Iron Contributor
Dec 04, 2025
Solved

How to write a script or any PQ or in Excel to download the zip files from a Webpage

Dear Experts,                      Greetings! https://www.etsi.org/deliver/etsi_ts/138300_138399/138306/   Could you please help me on how to download the pdf.zip files from above for all the ver...
  • Lorenzo's avatar
    Dec 15, 2025

    A better option:

    let
        Source = Web.BrowserContents( "https://www.etsi.org/deliver/etsi_ts/138300_138399/138306/" ),
        UrlRoot = "https://www.etsi.org",
        // All Parent 'directory' link end with ".00_60/"
        ParentLinks = Html.Table( Source,
            { {"Parent_Link", "a[href$='.00_60/']", each UrlRoot & [Attributes][href]} }
        ),
        PdfContents = Table.AddColumn( ParentLinks, "PdfContents", each
            let
                childContents = Web.BrowserContents( [Parent_Link] ),
                // Only one pdf file in sub-directory
                pdfLink = Table.FirstValue(
                    Html.Table( childContents,
                        { {"Pdf_Link", "a[href$='.pdf']", each UrlRoot & [Attributes][href]} }
                    )
                )
            in
              Pdf.Tables( Web.Contents( pdfLink ) , [Implementation = "1.3"] ),
              Table.Type
        )
    in
        PdfContents

     

    EDIT: CSS Selectors: https://www.w3schools.com/cssref/css_selectors.php

    let
        OneParentLink = Web.BrowserContents( "https://www.etsi.org/deliver/etsi_ts/138300_138399/138306/15.02.00_60/" ),
        UrlRoot = "https://www.etsi.org",    
    
        // Get <a href>'s ending with '.pdf' 
        OptionOne = Html.Table( OneParentLink,
            { {"Pdf_Link", "a[href$='.pdf']", each UrlRoot & [Attributes][href]} }
        ),
    
        OptionTwo = Html.Table( OneParentLink,
            { {"Pdf_Link", "a", each UrlRoot & [Attributes][href]} },
            [RowSelector = "a[href$='.pdf']"]
        )
    in
        OptionTwo

     

Resources