IMPORTDATA, IMPORTXML and IMPORTHTML in Google Sheets

What each built-in import formula reads, how often it refreshes, the errors people hit with them, and when a scheduled import is the better fit.

By Jake Marsh. Updated Nov 29, 2026.

The four formulas, side by side

Google Sheets has four formulas that fetch data from an address. They look alike and they're easy to mix up:

FormulaReadsSyntaxReturns
IMPORTDATAA CSV or TSV fileIMPORTDATA(url)The file as rows and columns
IMPORTXMLXML, HTML, CSV, TSV, RSS and AtomIMPORTXML(url, xpath_query, [locale])Whatever the XPath query selects
IMPORTHTMLA table or list on a web pageIMPORTHTML(url, "table" or "list", index)That one table or list
IMPORTFEEDAn RSS or Atom feedIMPORTFEED(url, [query], [headers], [num_items])Feed items: title, summary, address and date

All four need the full address, including https://, either in quotes or in a cell the formula points to.

IMPORTDATA

The simplest one. Point it at a CSV and the file appears:

=IMPORTDATA("https://example.com/exports/orders.csv")

It's ideal for government data, a supplier's price file, or any system that can publish a CSV at a stable address. It can't send a header, so it can't log in to anything.

IMPORTXML

IMPORTXML runs an XPath query over the page or file and returns what matches. To pull every link on a page, =IMPORTXML("https://example.com", "//a/@href"); to pull the titles from a feed, =IMPORTXML("https://example.com/feed.xml", "//item/title"). It's the most flexible of the four and the most fragile when the page changes shape. Pulling structured XML into proper columns has its own guide: how to import XML into Google Sheets.

IMPORTHTML

IMPORTHTML takes the page, the word "table" or "list", and which one counting from 1. Tables and lists are counted separately, so a page can have both a table 1 and a list 1. =IMPORTHTML("https://example.com/rates", "table", 2) returns the second table on the page.

How often they refresh

Google's help page is specific: IMPORTDATA, IMPORTHTML and IMPORTXML check for updates every hour while the document is open, even if nothing in the sheet changes. Deleting and re-adding the formula, or overwriting it with the same formula, makes it fetch again. Opening or reloading the document does not. IMPORTRANGE, the formula that reads another spreadsheet, runs on its own 30-minute cycle.

The consequence that surprises people: these formulas don't run while nobody has the file open. If the sheet feeds a report someone opens on Monday, the numbers are as old as the last time it was open, until the hourly check catches up. The refresh guide covers the ways to update a closed sheet.

The errors you'll see, and what they mean

When a scheduled import fits better

The import formulas are the right tool for public files that are already shaped like a table. They run out of road when:

If your sheet already has IMPORTDATA or IMPORTXML formulas, or IMPORTJSON formulas from one of the popular scripts, Cellfetch can find them and turn each one into a saved request that writes to the same place and refreshes on a schedule, or into a =CELLFETCH() formula with the same address. Keys in the addresses move into a connection. IMPORTXML formulas over XML feeds and APIs convert; formulas that scrape web pages stay as they are. For the general picture of calling an API from a sheet, start with how to use an API in Google Sheets.

Questions

How often do IMPORTDATA, IMPORTXML and IMPORTHTML refresh?

About once an hour, and only while the document is open. Reloading the page doesn't make them refresh; changing the formula or a cell it reads does.

Why does my IMPORT formula show #REF! until I click something?

The first time an import formula is added to a sheet, Google shows a banner asking an editor to click Allow access. Until someone does, every import in the file is blocked. It's asked once per file, and only editors can answer it.

Can I use IMPORTDATA with an API that needs a key?

Only if the API accepts the key in the address, and then the key is visible to everyone the sheet is shared with. IMPORTDATA takes one argument, the address, so it can't send a header.

Is there a limit on how many IMPORT formulas a sheet can have?

Google doesn't publish a number. Its help page says that when import functions create too much traffic you get an error asking you to reduce them, and that the limits count everything across the spreadsheets you created, including edits by collaborators.

All guides

Install Cellfetch

From inside a sheet: Extensions > Add-ons > Get add-ons, search Cellfetch, Install. Then Extensions > Cellfetch > Start.