Using the IMPORTXML
function in Google Sheets, I'm trying to get the 'properties' element values from this link to appear with their element names as column headers.
Using the below XPath query outside Google Sheets, I'm able to get the data to display the element names and their values in rows separated by a space. In Google Sheets, I get an error (Imported Xml content can not be parsed.
).
//*[local-name() = 'properties']/*[not(*)]/concat(local-name(), ' ', .)
I have a sample spreadsheet here with the desired output. Cell B12 contains the IMPORTXML
formula that refers to the XPath in cell B4 (labeled as XPATH Query 2). Cell B3 ("XPATH Query 1") contains the query that seems to work outside of Google Sheets.
The below image displays the current output of cell B12 outlined in red and the desired output beginning in cell D11.