Skip to content
Home

/

Blog

/

Technical

/

IMPORTXML "Could Not Fetch URL" and "Imported Content Is Empty": Causes and Fixes

Published

9 min read

IMPORTXML "Could Not Fetch URL" and "Imported Content Is Empty": Causes and Fixes

Why Google Sheets' IMPORTXML and IMPORTHTML return "Could not fetch url", "Imported content is empty" or endless Loading, how to tell which cause you have in a minute, and what to use when the page is JavaScript-rendered, blocked or behind a login.

Autonoly Team

Autonoly Team

AI Automation Experts

importxml could not fetch url
importxml imported content is empty
importhtml not working
importxml not working
google sheets could not fetch url
importxml javascript
importxml loading
importxml alternative

Quick Diagnosis: Match the Error to the Cause

Hover over the red triangle on the #N/A or #REF! cell to see the exact message, then find it here:

Error messageWhat it usually meansFirst thing to try
Could not fetch url: https://...Google's servers couldn't download the page: the site blocked them, the URL needs a login, it redirects or times out, or Google's fetcher had a temporary failureOpen the URL in a private window; if it works there, the site is probably blocking Google's fetcher
Imported content is emptyThe page downloaded, but your XPath matched nothing in the raw HTML. Usually the data is added by JavaScript, or the XPath was copied from InspectSearch View page source for the value you want
Imported Xml content can not be parsedThe XPath has a syntax error, or the response isn't valid XML/HTML (e.g. a JSON or PDF URL)Check quotes and brackets in the XPath; use single quotes inside the double-quoted formula
Resource at url not foundThe server answered with an error such as 404 for that URLCheck the URL for typos, tracking parameters or a page that moved
Result too largeYour XPath returns more data than Sheets will import in one callNarrow the XPath to the elements you need
Loading... that never finishes, or "Loading data may take a while because of the large number of requests"Too many IMPORT functions in the spreadsheetCut the number of IMPORT calls (see below)

Google's own help page on import functions documents the "large number of requests" and "Result too large" messages; the rest come from how the fetcher behaves in practice. The same causes apply to IMPORTHTML, IMPORTDATA and IMPORTFEED.

"Could Not Fetch URL": Causes and Fixes

IMPORTXML doesn't fetch from your computer. Google's servers request the page, so anything that blocks or confuses an automated request from a Google data centre produces this error, even when the page opens fine in your browser.

1. The site blocks Google's fetcher

This is the most common cause on big sites. Shops, marketplaces, ticketing, social and finance sites often run bot protection (Cloudflare and similar) that returns a 403 or a challenge page to requests that don't look like a person in a browser. Every IMPORTXML user shares Google's fetchers, so popular sites see heavy traffic from them and many block it. A tell-tale sign: =IMPORTXML("https://example.com","//title") fails on that domain but works on others.

Fix: there's no setting in Sheets that changes how Google identifies itself. Use the site's API or export if it has one, or fetch the page with something that behaves like a real browser (see the last section).

2. Rate limiting

Dozens of IMPORTXML cells pointing at the same domain fire at once. The site may answer the first few and refuse the rest, which is why errors often appear on some rows and not others, or come and go. Fix: fewer calls (one IMPORTXML that returns a whole column instead of one per row), and fewer URLs per sheet.

3. Login, consent or region pages

Pages behind a login can't be fetched: Google's servers don't have your cookies. Some sites also show a cookie-consent wall, a country selector or a different page to visitors from another region, and Google fetches from its own data centres, not from where you are. Fix: nothing in Sheets can sign in for you. Look for a public version of the page, a shareable export link, or switch to a browser-based tool that can log in.

4. The URL itself

  • Typos, spaces or line breaks pasted into the URL cell. Wrap it in TRIM().
  • Missing https://.
  • Very long URLs with tracking parameters; strip everything after ? that the page doesn't need.
  • Pages that redirect several times or load slowly can time out.

5. robots.txt and Google-side hiccups

Some users report imports failing on sites whose robots.txt disallows automated access, and the error is also sometimes intermittent, with the same URL working an hour later. Google doesn't document either behaviour, so treat them as things to rule out last, after checking the causes above.

"Imported Content Is Empty": Causes and Fixes

This one means the fetch worked, but your XPath found nothing in what Google received.

1. The data is rendered by JavaScript (most common)

IMPORTXML and IMPORTHTML read the HTML the server sends before any JavaScript runs. Prices, stock levels, search results and tables on modern sites are often inserted later by scripts calling an API. You see them in the browser; IMPORTXML never does.

Test: right-click the page, choose View page source (not Inspect), and Ctrl+F for a value you can see on screen. If it's not in the source, no XPath will reach it with IMPORTXML. Our guide to scraping dynamic websites explains the alternatives in depth.

2. The XPath was copied from Inspect

"Copy XPath" in DevTools describes the rendered DOM, which can differ from the raw HTML:

  • Browsers insert <tbody> into tables even when the source has none. Remove /tbody from the path or use //table//tr.
  • Absolute paths like /html/body/div[3]/div[2]/span break if one element is added. Prefer attributes: //span[@class='price'], or //span[contains(@class,'price')] when the element has several classes.
  • Elements added by scripts (banners, injected wrappers) change the positions in the copied path.

3. The page Google gets is different

A consent page, a "choose your country" page or a bot challenge has no element matching your XPath. Test with =IMPORTXML(A1,"//title"): if the title is "Just a moment...", "Access denied" or a consent message, you're looking at the blocking problem from the previous section.

4. The value is in an attribute or a script

Use //a/@href or //meta[@property='og:price:amount']/@content for attributes. If the value only appears inside a <script> block (JSON on the page), you can sometimes pull it with REGEXEXTRACT(IMPORTXML(A1,"//script[@type='application/ld+json']"),"price.:.?([0-9.]+)"). It's fragile, but it's free.

IMPORTHTML Not Working

IMPORTHTML(url, "table", n) has the same fetch limits plus two of its own:

  • Wrong index. n counts <table> (or <ul>/<ol> for "list") elements in the raw HTML, starting at 1, including invisible layout tables. Try 1, 2, 3... until the right one appears.
  • Not a real table. Many "tables" on modern sites are built from <div>s with CSS grid. IMPORTHTML only sees real <table> elements; use IMPORTXML with an XPath on the divs instead.

Too Many IMPORT Calls: "Loading..." Forever

Google limits the traffic import functions can create. When a spreadsheet has many of them, cells sit on Loading... or show the "large number of requests" message. Third-party guides often quote a fixed limit, but Google doesn't publish a single number. What helps:

  • One call, many results. An XPath like //div[@class='item']//h3 returns every match down a column. One formula instead of 100.
  • Don't import the same URL twice. Fetch it once and reference those cells, or use INDEX() on one result.
  • Freeze results you don't need live. Copy and Paste special > Values only, so old rows stop re-fetching.
  • Split across files if you genuinely need hundreds of URLs, or move the fetching out of formulas.

Note also that you can't control when IMPORTXML refreshes. Sheets re-fetches on its own schedule, so it's poor at "check this price every morning and keep a history".

When to Stop Fighting IMPORTXML

IMPORTXML is great for static, public pages and a handful of values. Switch tools when any of these are true:

  • The value isn't in View page source (JavaScript-rendered).
  • The site blocks Google's fetcher, and errors won't go away.
  • The page needs a login, a click, a search or scrolling first.
  • You need a dated history (one row per run), not a value that silently refreshes.
  • You need more than a few dozen URLs.

Your options:

  • Apps Script with UrlFetchApp gives you control over timing and writes values (not formulas), but it is still a plain HTTP fetch from Google: no JavaScript, and the same blocking. It works well when the site has a public JSON API you can call.
  • Your own script (Python with Playwright) renders the page in a real browser and writes to Sheets through the Sheets API. Full control, but you host and maintain it.
  • A browser-based scraper that writes to Sheets, such as the option below.

Using a Browser-Based Scraper That Writes to Google Sheets

Autonoly runs a real Chromium browser in the cloud, so it sees the page after JavaScript has run, and it has a native Google Sheets integration.

For a one-off or ad-hoc pull, ask the agent. For example: "Open these 40 product URLs from column A of my 'Watchlist' sheet, get the current price and stock status from each, and write them to the 'Prices' tab with today's date." The agent handles pages that need scrolling, clicking or a login (it can ask you for credentials), and you can watch it in the live view.

For a recurring pull, save a scheduled workflow:

  1. Launch Browser on the page.
  2. Wait For the element that holds your data.
  3. Extract Data for single values, Extract Table for tables, or Extract Child Collection for repeated items such as product cards. Selectors can be CSS or the same XPath you used in IMPORTXML.
  4. Google Sheets (write), which appends rows by default, so each run adds a dated snapshot instead of overwriting.
  5. Run it on a schedule, for example every weekday at 8:00 in your timezone.

Be realistic about the limits: saved workflows can't sign in with stored credentials (so pages behind a login are an agent task), there's no proxy rotation, and sites with strong bot protection may still show a challenge. reCAPTCHA v2 and hCaptcha can be solved when enabled; other challenges are handed to you via live takeover. Each workflow covers a fixed set of pages, since there's no loop step; for a long, changing list of URLs, use the agent. See data extraction for the details.

Frequently Asked Questions

Because Google's servers fetch the page, not your browser. Sites with bot protection often block those requests, pages behind a login can't be fetched, and some sites show different pages to other regions. Test with =IMPORTXML(url,"//title"): if that fails too, the site is blocking the fetch.

Related terms, automations and guides

The concepts and workflows referenced in this article.

GuideHow to Scrape Any Website Directly Into Google Sheets Without CodeLearn how to scrape data from any website and send it directly to Google Sheets without writing code. This comprehensive guide covers the end-to-end flow from website to structured spreadsheet data, including handling dynamic sites, pagination, data cleaning, and scheduled runs.GuideHow to Scrape and Crawl Dynamic Websites (Why JavaScript Pages Come Back Empty)Why requests, BeautifulSoup and Google Sheets' IMPORTXML return empty results on JavaScript pages, and the four ways to get the data: embedded JSON, the site's own XHR/JSON endpoints, a rendered browser with proper waits, and handling infinite scroll, load-more buttons and JS-built links when crawling.GuideHow to Automate Google Sheets: Scrape, Transform, and Report on AutopilotLearn how to automate Google Sheets workflows including data scraping, transformation, and reporting. This guide covers auto-populating spreadsheets from websites, scheduling data updates, building self-refreshing dashboards, and connecting Sheets to your entire tool stack.GuideWeb Scraping with Python: A Practical Guide for BeginnersLearn web scraping with Python from scratch. Covers Requests, BeautifulSoup, Scrapy, and Playwright for extracting data from static and dynamic websites with practical code examples and best practices.GuideAnti-Bot Detection Explained: Why Your Scraper Gets Blocked (and What Actually Helps)How Cloudflare, DataDome, HUMAN and other bot-management systems decide your scraper is a bot, what 403, 429 and challenge pages mean, and the legitimate ways to get blocked less: APIs, rate limits, real browsers and asking for access.DefinitionRate LimitingRate limiting is a technique that controls the number of requests a client can make to a server within a given time window, preventing abuse and ensuring fair resource distribution.DefinitionPlaywrightPlaywright is Microsoft's open-source browser automation framework that provides a single API to control Chromium, Firefox, and WebKit browsers. It supports headless and headed modes, auto-waiting, and network interception, making it a leading choice for testing and web scraping.DefinitionIMPORTHTMLIMPORTHTML is a Google Sheets function that imports a whole HTML table or list from a web page into your spreadsheet, chosen by its position on the page. It is the quickest way to pull a static table into Sheets, and it shares IMPORTXML's limits: no JavaScript, no logins, hourly refresh.GuideWhy Your Zapier Workflows Keep Breaking: 7 Fixes for Unreliable AutomationDiscover why Zapier workflows fail and 7 proven fixes for unreliable automation. Learn how to build bulletproof workflows that work…GuideMy Automation Failed: 7 Common Workflow Automation Mistakes and How to Fix ThemLearn why your automation failed and how to fix it. Discover the 7 most common workflow automation mistakes and proven solutions to get…

Put this into practice

Build this workflow in 2 minutes — no code required

Describe what you need in plain English. The AI agent handles the rest.

Free forever up to 100 tasks/month