Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9704

Google Sheets IMPORTXML's XPath Query for Siblings

$
0
0

What XPATH syntax works with Google Sheet's IMPORTXML function that will retrieve multiple siblings and place them in separate cells?

In this XML sample code, I'm trying to retrieve all elements after <principal>.

<Comps>
    <response>
        <properties>
            <principal>
                <title>Test data</title>
                <misc>Test data 2</misc>
                <links>
                    <homedetails>details</homedetails>
                    <graphsanddata>graphs</graphsanddata>
                    <mapthishome>maps</mapthishome>
                    <comparables>comparables</comparables>
                </links>
            </principal>
        </properties>
    </response>
</Comps>

I use the following formula:

=IMPORTXML(url, "//principal/*")

The result appears on separate rows as:

Test data
Test data 2
detailsgraphsmapscomparables

The four siblings under <links> are placed in one cell.

How can I disaggregate those siblings into separate cells like the following:

Test data
Test data 2
details
graphs
maps
comparables

Viewing all articles
Browse latest Browse all 9704

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>