Category: FUNCTION | Updated: 2026-11-22
How to Use the IMPORTDATA Function: Import CSV and TSV Data Directly from the Web
Overview of the IMPORTDATA Function
The IMPORTDATA function takes the URL of a publicly accessible CSV (comma-separated) or TSV (tab-separated) file on the web and expands its contents directly into Google Sheets. It is convenient for automatically pulling open government data or periodically updated external reports.
Syntax
=IMPORTDATA(url, [delimiter], [locale])
- url: The public URL (
"https://...") of the.csvor.tsvfile. - delimiter (optional): The character used to separate data fields. If omitted, it is automatically detected (comma or tab) based on the file format.
- locale (optional): The region and language code used to parse the data (e.g.,
"en_US"or"ja_JP").
Practical Examples with a Table
This example imports publicly available CSV and TSV data by specifying their URLs.
| Cell | A (CSV File URL) | B (Formula) | C (Sample Result) |
|---|---|---|---|
| 1 | URL | Formula | Expansion Behavior |
| 2 | https://example.com/data/sales.csv | =IMPORTDATA(A2) |
Row 1, Column 1 of the CSV goes into B2, and the rest expands right and down |
| 3 | https://example.com/data/log.tsv | =IMPORTDATA(A3, "\t") |
Automatically expands tab-delimited data |
Common Errors and Precautions
- Google Drive share links: Passing a standard Google Drive sharing URL (
/file/d/.../view) for a CSV file will treat it as an HTML page and cause an error. You must convert it to a direct download link or use a “Publish to the web” link. - File size and cell limits: If the CSV file is extremely large (e.g., tens of thousands of rows or more), resource limits may trigger an error.
- Garbled characters due to encoding: If the source CSV file is saved in an encoding other than UTF-8 (such as Shift-JIS), non-ASCII text such as Japanese characters will be imported as garbled text.
Frequently Asked Questions
Q. Can IMPORTDATA load a CSV file stored on my local PC?
A. No. IMPORTDATA only supports files available at public internet URLs (http or https). To load a local file, use 'File' > 'Import' from the menu.
Q. Why does Japanese text imported with IMPORTDATA appear garbled?
A. Text can appear garbled if the source CSV file uses an encoding such as Shift-JIS. Google Sheets is optimized for UTF-8 encoded files.