
What the IMPORTXML Google Sheets Function Can and Cannot Collect
IMPORTXML is a formula that fetches a web page and returns whatever your XPath query matches, and it only checks that page for changes while the spreadsheet is open. That condition decides how you should use it. Treat it as a live lookup for someone looking at the sheet. When you need a record that builds up while nobody is watching, reach for something else.
Table of Contents
- The Formula and Its Three Arguments
- A Lookup Function, Not a Collector
- Why a Working Formula Stops Returning Data
- Testing a Formula Before You Trust It
- When the Data Needs Collecting, Not Looking Up
- Frequently Asked Questions
The Formula and Its Three Arguments
=IMPORTXML(url, xpath_query, locale)Google's documentation gives the signature as IMPORTXML(url, xpath_query, locale). Each argument does one job:
- url is the page to examine, including its protocol, such as http:// or https://.
- xpath_query is the XPath expression that picks out the part of the page you want, such as every heading or every link.
- locale is a language and region code used when parsing the data; leave it out and the document's own locale applies.
A filled example, pointing at a placeholder blog page:
=IMPORTXML("https://www.example.com/blog", "//h2")The query //h2 asks for every h2 heading on the page, so the cell fills with the post titles. In a real sheet, put the URL in its own cell and write =IMPORTXML(A2, "//h2"). Then one formula copied down a column handles a list of pages, and fixing a URL never means editing a formula. When a page still refuses to cooperate, we keep a page of working fixes for the cases the formula cannot handle.
A Lookup Function, Not a Collector
IMPORTXML is a Google Sheets import function: it fetches one URL, runs an XPath query against what comes back, and writes the matches into cells. It reads several structured formats, including XML, HTML, CSV, TSV, and RSS and ATOM feeds, which makes it a good fit for an analyst who wants a live number or a list of headlines beside their own data. It shares a refresh rule with IMPORTDATA and IMPORTHTML: Google states that all three check for updates every hour while the document is open, even if the formula and sheet don't change. That rule separates looking something up from collecting it. Your real question may be how to extract data from a website to Google Sheets automatically, on a schedule, with nobody opening the file. The function was never built for that, and a tool that can update a Google Sheet automatically is the closer fit.
Why a Working Formula Stops Returning Data
A URL typed as example.com/ is a common reason a formula errors before it reaches the page. The url argument has to include the protocol, http:// or https://, before the domain. Copy the address straight from the browser's address bar rather than retyping it, and the problem disappears. If the URL lives in a cell, check that cell for stray spaces too.
Prices that come back as text, or as the wrong value, usually point to the third argument. When the locale argument is left out, the formula parses with the document's locale, so a page written in one number format gets read with your sheet's rules. Pass the page's locale explicitly whenever the source is in a different region from your spreadsheet.
Setting up the formula on Friday and expecting Monday's sheet to show the weekend's changes misreads when it runs. The hourly check happens while the document is open, and the function's three arguments offer nowhere to store what it returned last week. Each fetch replaces the cell's contents. If you need a price history, a Sheets price tracker that keeps last week's price beside the new one does what the formula can't.
Supplier portals, account dashboards and member pricing sit behind a sign-in, and the formula has no argument for one: its signature is url, xpath_query and locale, nothing else. Sharing a password or exporting cookies to a third-party service to get around this only moves the risk somewhere else. Reading those pages needs a tool that runs in a browser where you are already signed in, which is how we scrape a site behind a login.
Testing a Formula Before You Trust It
- Paste the full URL, protocol included, into cell A2 and open it in a browser tab to confirm the page loads without a sign-in.
- Write
=IMPORTXML(A2, "//title")in B2. If the page title appears, the fetch works, and any later error comes from your XPath, not the URL. - Narrow the query one step at a time, from
//h2to a specific class or position, and check the result after each change. - Format the result column as a number and look for values stuck as text or with misplaced decimals. If you see them, add the page's locale as the third argument.
- Close the sheet, reopen it later, and compare a value against the live page to confirm the refreshed result matches what the site shows now.
If step 2 fails on a page that loads fine in your browser, the formula cannot read that page. Stop adjusting XPath at that point.
When the Data Needs Collecting, Not Looking Up
BrowseWiz handles the jobs this formula leaves undone. You describe the rows you want in plain words, with no selectors or scrapers to build or fix. BrowseWiz reads those pages in the Chrome you are already signed into, with no cookie or password upload. BrowseWiz writes the rows into a new Google Sheet in your Drive, with a Source column on every row. One plain-language message can cover several sites, instead of a robot per site. That is useful when a lead list draws on more than one directory.
Scheduled refreshes run up to once a day, at the time you set, and update rows in place while keeping the old value. That is less often than the formula's hourly check. So for a public figure that moves within the hour, on a sheet you keep open, the formula is the quicker option.
Scheduled refreshes and monitors run only while Chrome is open. That is the same kind of dependency the formula has on an open spreadsheet, but a browser you leave running is easier to arrange than a spreadsheet tab. The Free plan includes one daily scheduled task and one monitor. To talk through your use, contact us, or compare plans on the pricing page.
Frequently Asked Questions
Can IMPORTXML read an RSS feed or a CSV file instead of a web page?
Yes. It imports XML, HTML, CSV, TSV, and RSS and ATOM XML feeds. When a site offers a feed, point the formula at the feed rather than the HTML page. A feed's structure is plainer and changes less often than a page layout, so a query like //item/title is simpler to write than a path through a designed page. It also tends to keep working after a site redesign. Check for a feed link in the site's footer or page source before building XPath against the visible page.
How do I keep a record of the values IMPORTXML returns?
The formula itself only shows the latest fetch, so any history has to come from somewhere else. By hand, that means copying the result column and pasting it as values into a dated tab each time you check, which works but depends on remembering. BrowseWiz keeps previous values in their own column beside the refreshed ones. Each scheduled run updates the current value while the old one stays visible next to it. That way you see the change without building a copy routine.
What happens when a site signs me out?
BrowseWiz works inside your own logged-in Chrome, so no cookies or passwords are uploaded. The flip side is that your session is the only access it has. If a site signs you out, you sign in again in Chrome, and the next run reads the page as before. Sites that time out sessions often deserve a quick look on the morning of a scheduled run. Asking for a "Signed out" note in place of a value makes a lapsed session obvious in the sheet.

About Tom
I'm a software engineer and solutions architect specializing in AI-driven tools and productivity software, passionate about helping users reclaim their valuable time through intelligent automation.