Skip to main content
More Menu
Reading ListGanti ke TerangSearch
Reading List

Queue · 0 items

Your reading list is empty. Save articles to read them later.

Start Reading
ESCto close
↑↓to navigate

Google Sheets IMPORT Functions: IMPORTRANGE, IMPORTHTML, IMPORTXML

SheetHub4 min
Most spreadsheet data lives inside your sheet. But what if the data you need is in another sheet? Or on a website? Or in a CSV file on a server? Google Sheets has four IMPORT functions that pull external data into your spreadsheet. They update automatically, so your data stays current without manual copying.

Why This Matters

Importing data manually is error-prone. You copy, paste, format, repeat. If the source changes, your copy is outdated. IMPORT functions keep everything synced automatically.

IMPORTRANGE — From Another Sheet

Import data from a different Google Sheet.

Syntax

=IMPORTRANGE(spreadsheet_url, range_string)

Example

=IMPORTRANGE("https://docs.google.com/spreadsheets/d/abc123", "Sheet1!A1:C100")
First time: Sheets asks you to Allow Access. Click it. After that, data syncs automatically. Use with QUERY for filtered imports:
=QUERY(IMPORTRANGE("url", "Sheet1!A1:C100"), "SELECT * WHERE Col2 > 500")

IMPORTHTML — From a Web Table

Import a table or list from any web page.

Syntax

=IMPORTHTML(url, query, index)

Example

=IMPORTHTML("https://en.wikipedia.org/wiki/List_of_countries_by_GDP", "table", 1)
Imports the first table from the Wikipedia page.
ArgumentDescription
urlFull URL of the web page
query"table" for HTML tables, "list" for HTML lists
indexWhich table/list on the page (1 = first, 2 = second, etc.)

IMPORTXML — From Structured Data

Import data from XML, HTML, or RSS feeds using XPath queries.

Syntax

=IMPORTXML(url, xpath_query)

Example

=IMPORTXML("https://example.com", "//h1")
Returns all H1 headings from the page. Get all links from a page:
=IMPORTXML("https://example.com", "//a/@href")
Get page title:
=IMPORTXML("https://example.com", "//title")

IMPORTDATA — From CSV/TSV

Import a CSV or TSV file directly from a URL.

Syntax

=IMPORTDATA(url)

Example

=IMPORTDATA("https://example.com/data.csv")
No parsing needed — Sheets automatically splits the data into columns.

Comparison

FunctionBest ForUpdate Frequency
IMPORTRANGEOther Google SheetsEvery hour, or on change
IMPORTHTMLWeb tables and lists~Every 2 hours
IMPORTXMLStructured web data~Every 2 hours
IMPORTDATACSV/TSV files~Every hour
Import functions recalculate periodically. For real-time data, use Google Apps Script.

Pro Tips

Wrap in IFERROR to handle temporary failures:
=IFERROR(IMPORTRANGE("url", "Sheet1!A1:C100"), "Waiting for data...")
Use cell references for URLs. Put the URL in a cell and reference it:
=IMPORTRANGE(A1, "Sheet1!A1:C100")
Now you can change the URL without editing the formula. Combine with QUERY for large imports:
=QUERY(IMPORTRANGE("url", "Sheet1!A1:C10000"), "SELECT * WHERE Col1 IS NOT NULL")

Common Mistakes

Permission errors. IMPORTRANGE requires access to the source sheet. Click Allow Access the first time, or ensure both sheets are in the same Google account. HTML structure changes. IMPORTHTML and IMPORTXML break when the source website changes its layout. There is no fix except updating the formula. Rate limits. Import functions can be slow if too many are used in one sheet. Google limits import frequency to prevent abuse.

FAQ

Can I import from an Excel file? Not directly. Upload the Excel file to Google Drive first, then use IMPORTRANGE to reference it. Why is my IMPORTHTML returning #N/A? The page structure may have changed, or the table index is wrong. Try different index numbers (1, 2, 3...) to find the right table. How often do IMPORT functions refresh? Approximately every 1-2 hours. For immediate refresh, make a small edit to the sheet or use Google Apps Script.
Topics

Topics in this article

Explore related topics and continue reading similar content.

Share this article

Discussion

Preparing the comments area...

You Might Also Like