What Is the IMPORTDATA Function?
IMPORTDATA fetches data from a publicly accessible URL that serves CSV (comma-separated) or TSV (tab-separated) content and imports it directly into your spreadsheet. It automatically parses the rows and columns, so the data lands in a structured table without any manual copy-pasting. This is one of the most practical ways to connect a Google Sheet to a live data source, a public API endpoint, or an exported report.
Syntax
=IMPORTDATA(url)
| Parameter | Description |
|---|---|
| url | A string containing the full URL of the CSV or TSV file, or a cell reference that contains the URL. |
The URL must point to a publicly accessible resource. Files behind authentication or private networks will not load.
Basic Examples
Importing a Public CSV File
=IMPORTDATA("https://people.sc.fsu.edu/~jburkardt/data/csv/airtravel.csv")
This pulls in a classic air travel dataset with month-by-month passenger counts. The data appears starting in the cell where the formula is placed, spilling across as many rows and columns as the CSV contains.
Using a Cell Reference for the URL
=IMPORTDATA(A1)
Placing the URL in a cell makes it easy to swap data sources without editing the formula. You can even set up a dropdown to switch between different CSV endpoints.
Importing TSV Data
IMPORTDATA handles TSV files identically to CSV files. If the URL returns tab-separated values, the function detects the delimiter automatically:
=IMPORTDATA("https://example.com/data/export.tsv")
No additional configuration is needed. The data is split into columns based on the tab characters.
Advanced Examples
Pulling Live Data from a Public API
Many public APIs offer CSV output. For example, pulling earthquake data from the USGS:
=IMPORTDATA("https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_day.csv")
This imports all magnitude 2.5+ earthquakes from the past 24 hours, including timestamp, location, depth, and magnitude. The data refreshes periodically (usually every hour or so), giving you a near-live feed inside your spreadsheet.
Combining IMPORTDATA with QUERY for Filtering
The raw import might contain more data than you need. Use QUERY to filter it:
=QUERY(
IMPORTDATA("https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_week.csv"),
"SELECT Col2, Col5 WHERE Col5 > 4 ORDER BY Col5 DESC",
1
)
This imports the weekly earthquake feed but only shows the location and magnitude columns, filtered to magnitudes above 4.0, sorted from largest to smallest. The 1 at the end tells QUERY that the first row is a header.
Common Mistakes
- Exceeding the IMPORTDATA limit. Google Sheets limits each spreadsheet to 50 IMPORTDATA, IMPORTHTML, IMPORTXML, and IMPORTFEED calls combined. If you need to import many sources, consider using Apps Script or consolidating data into fewer endpoints.
- Expecting real-time updates. IMPORTDATA does not refresh continuously. Google Sheets typically recalculates import functions every 1-2 hours. You can force a refresh by deleting the formula and re-entering it, or by using a dummy parameter trick:
=IMPORTDATA(url & "?t=" & NOW()). Note that the NOW trick can be unreliable and may cause excessive API calls. - Importing non-CSV content. If the URL returns HTML, JSON, or any format other than CSV/TSV, IMPORTDATA will either error out or produce garbled results. For HTML tables, use IMPORTHTML. For structured web content, use IMPORTXML. For JSON, you will need Apps Script.
SheetAI Tip
Don't want to memorize this syntax? With SheetAI, just type what you need in plain English and the formula is generated for you. Install SheetAI to try it free.