Extract HTML table written using unordered list into Google sheets

Viewed 84

I am trying to covert the HTML table into Google sheet table using 'IMPORTXML' but I am not able to construct the query.

Using =IMPORTXML(A1,"//div[@class='dailynav']"), imports all the data in just one cell. I tried using 'table' but I think that does not work with tables. Please help me in constructing the formula.

Webpage: https://www.hdfcpension.com/about-hdfc-pmc/nav/

Relevant HTML code:

        <div class="dailynav">
            <h1>HDFC Pension - Daily NAV</h1>
            <ul>
                <li> <div class="bluebg"><span>Scheme Name</span><span class="leftWhiteBorder">NAV as on 02/05/2013</span></div></li>
                <li><p><span>HDFC Pension Fund Scheme C -Tier I</span><span class="numberleft">13.724</span></p></li>
                <li><p><span>HDFC Pension Fund Scheme E -Tier I</span><span class="numberleft"> 11.9621</span></p></li>
                <li><p><span>HDFC Pension Fund Scheme G -Tier I</span><span class="numberleft">13.1091</span></p></li>
                <li><p><span>HDFC Pension Fund Scheme C -Tier II</span><span class="numberleft">15.8436</span></p></li>
                <li><p><span>HDFC Pension Fund Scheme E -Tier I</span><span class="numberleft">13.4959</span></p></li>
                <li><p><span>HDFC Pension Fund Scheme G -Tier I</span><span class="numberleft">14.0168</span></p></li>
            
            </ul>
        </div>
1 Answers

use:

=IMPORTXML("https://www.hdfcpension.com/about-hdfc-pmc/nav/", 
 "//div[@class='dailynav']/ul/li/p")

enter image description here

Related