Skip to content
Google Sheets IMPORT functions · error message

Google Sheets: Imported Xml content can not be parsed

ConfigurationParsing and selecting content

Last verified

The exact message
Imported Xml content can not be parsed.

What it means

IMPORTXML (and sometimes IMPORTFEED) returns this #N/A error when Google downloaded something but could not turn it into a document tree it can query, or could not apply your query to it. The URL was reachable; the problem is in parsing.

In practice there are two families of cause. The first is the XPath itself: unbalanced brackets, mismatched quotes, or a predicate written in a form XPath 1.0 does not accept. The second is the response body: the URL returned something that is not HTML or XML at all, such as JSON, a binary file, an empty body, or an error page with a broken structure.

What is usually not wrong: access to the site. If the server had refused the request you would see Could not fetch url instead.

What it looks like

=IMPORTXML(A1, "//ul@[class'tags']/li")
#N/A  Imported Xml content can not be parsed.

=IMPORTXML(A1, "//ul[@class='tags']/li")

Why it happens

  • The XPath has a syntax error, such as a missing closing bracket, a stray @ before a bracket, or double quotes inside a double-quoted string.
  • The URL returns JSON, a PDF, an image or another non-markup format.
  • The response is malformed XML, for example a feed with an unescaped ampersand or an invalid character.
  • The server returned an empty body or a truncated response.
  • IMPORTFEED was pointed at a regular web page instead of an RSS or Atom feed.

How to fix it

  1. Replace your XPath with //title. If that works, the document parses and only your query is broken.
  2. Check the XPath for balanced brackets and use single quotes inside the formula's double-quoted string: "//div[@class='price']".
  3. Open the URL directly and check what it actually returns. If it is JSON, IMPORTXML is the wrong function.
  4. For feeds, validate the feed URL in a feed validator and fix or replace it if it is not well formed.
  5. For IMPORTFEED, confirm the URL is the feed itself (often ending in /feed, /rss or .xml), not the blog's home page.

How to stop it recurring

Build XPath queries incrementally: start from //title, then a broad element, then narrow down, testing each step. Keep the query in its own cell so it is easy to read and edit. Use IMPORTXML only for HTML and XML, IMPORTDATA for CSV and TSV, and IMPORTFEED for RSS and Atom; none of the built-in functions parse JSON.

Official documentation: support.google.com/docs/answer/3093342. See all Google Sheets error messages or the Google Sheets limits and quotas.

Related errors

Definitions

Quick answers

What does "Imported Xml content can not be parsed" mean in Google Sheets?

IMPORTXML (and sometimes IMPORTFEED) returns this #N/A error when Google downloaded something but could not turn it into a document tree it can query, or could not apply your query to it. The URL was reachable; the problem is in parsing. In practice there are two families of cause. The first is the XPath itself: unbalanced brackets, mismatched quotes, or a predicate written in a form XPath 1.0 does not accept.

How do I fix "Imported Xml content can not be parsed"?

1. Replace your XPath with //title. If that works, the document parses and only your query is broken. 2. Check the XPath for balanced brackets and use single quotes inside the formula's double-quoted string: "//div[@class='price']". 3. Open the URL directly and check what it actually returns. If it is JSON, IMPORTXML is the wrong function. 4. For feeds, validate the feed URL in a feed validator and fix or replace it if it is not well formed. 5. For IMPORTFEED, confirm the URL is the feed itself (often ending in /feed, /rss or .xml), not the blog's home page.

When an IMPORT formula cannot read the page

IMPORTXML and IMPORTHTML only see the HTML the server sends. An Autonoly extraction step reads the page in a real browser and writes rows to Google Sheets. Sites that block automated visitors can still block it.

Also see Google Sheets integration.