1
votes

I have a fairly simple XML to import into Google Sheets but no matter how much I try, it still won't work. The error message is always:

Error Imported XML content cannot be parsed.

I've tried a few combinations, including:

//ViewGetItemsResponse/ItemList/Item/@date

=importxml("https://example.com/rest?WebServiceKey=blah&ViewID=1004&PageNumber=1&PageItemCount=10", "//ViewGetItemsResponse/ItemList/Item/@date")

Example XML:

<?xml version="1.0" encoding="utf-8"?>
<ViewGetItemsResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Result>Success</Result>
  <PageItemCount>2</PageItemCount>
  <PageNumber>1</PageNumber>
  <PageCount>26</PageCount>
  <ItemList>
    <Item>
      <ItemID>1004</ItemID>
      <Date>2015-03-05 00:00:00</Date>
      <Frontpagearticles>Example 1</Frontpagearticles>
      <LocationUrl>Example.com</LocationUrl>
      <NowTrendingarticles />
      <TopNav />
      <Created>2015-03-13 09:02:48</Created>
      <CreatedBy>Administrator</CreatedBy>
      <Deleted />
      <DeletedBy />
      <ItemID1>1004</ItemID1>
      <ItemSourceItemID>4</ItemSourceItemID>
      <ItemSourceName>1003</ItemSourceName>
      <ItemSourceType>Agent</ItemSourceType>
      <Modified />
      <ModifiedBy />
      <Refreshed>2015-03-13 09:02:48</Refreshed>
      <RefreshedBy>Administrator</RefreshedBy>
    </Item>
    <Item>
      <ItemID>1008</ItemID>
      <Date>2015-03-03 00:00:00</Date>
      <Frontpagearticles>Example2</Frontpagearticles>
      <LocationUrl>Example2.com</LocationUrl>
      <NowTrendingarticles />
      <TopNav />
      <Created>2015-03-13 09:03:02</Created>
      <CreatedBy>Administrator</CreatedBy>
      <Deleted />
      <DeletedBy />
      <ItemID1>1008</ItemID1>
      <ItemSourceItemID>8</ItemSourceItemID>
      <ItemSourceName>1003</ItemSourceName>
      <ItemSourceType>Agent</ItemSourceType>
      <Modified />
      <ModifiedBy />
      <Refreshed>2015-03-13 09:03:02</Refreshed>
      <RefreshedBy>Administrator</RefreshedBy>
    </Item>
  </ItemList>
</ViewGetItemsResponse>
1

1 Answers

0
votes

As a last resort you can use import data to pull in the information and format it afterwards, alternatively if you share a real link to the data to import - will likely be able to give you a specific answer to solve the question.