The IMPORTDATA function in Google Sheets is a powerful tool that allows users to import data from external web sources directly into their spreadsheets. This function facilitates easy access to publicly available datasets and can be particularly useful for data analysis, reporting, or integrating real-time information.
Syntax
IMPORTDATA(url)
- url: The URL that points to a .csv or .tsv file containing the data you wish to import.
Example #1
=IMPORTDATA("https://example.com/data.csv")
This function fetches data from a given CSV file located at the specified URL. For example, if the CSV contains sales data, you would see a table of sales figures populate your sheet, such as:
| Date | Sales |
|————|——-|
| 2023-01-01 | 1000 |
| 2023-01-02 | 1500 |
Example #2
=IMPORTDATA("https://example.com/data.tsv")
This function imports a TSV file from the provided URL. If the TSV file contains website traffic statistics, your sheet could be populated as follows:
| Date | Visitors |
|————|———-|
| 2023-01-01 | 300 |
| 2023-01-02 | 450 |
Example #3
=IMPORTDATA("https://example.com/data.csv")
This example utilizes the same function to try and import data from a different CSV endpoint. If this URL leads to a sports statistics file, your sheet may reflect data like:
| Team | Wins |
|———-|——|
| Team A | 5 |
| Team B | 3 |
Error handling
- N/A: Indicates that the URL provided cannot be found or is unreachable.
- VALUE: Indicates that the function was unable to parse the data correctly, often due to an improper format.
- REF: Occurs when the URL is invalid or has been removed from the source.