How to Use IMPORTDATA function in Google Sheets

By

Watch Video – IMPORTDATA Function in Google Sheets

IMPORTDATA function is Google sheets allows you to quickly import the data from the URL of a .csv (comma separated value) or .tsv (tab-separated value) file.

This can be useful if you’re working with data that is available online in a .csv/.tsv file. Using IMPORTDATA function, you can instantly get the data in Googe Sheets (instead of going the longer route of downloading the .csv/.tsv file and then copy-paste and format the data).

In this tutorial, I will show you how to import the entire data set or part of a dataset using the IMPORTDATA function in Google Sheets.

Before we get into the example, let’s first look at the syntax of the function.

IMPORTDATA Function – Syntax

IMPORTDATA("URL")
  • URL – this function only takes one argument. You need to specify the complete URL of the file location and make sure it is with double-quotes. If you have the URL in a cell in Google Sheets, you can also specify the cell reference instead of the URL. For example, if the URL is in cell A1, the formula would be =IMPORTDATA(A1)

Now let’s take an example and see how to fetch the data using IMPORTDATA function in Google Sheets.

Example 1 – Fetch All the Data from a URL using IMPORTDATA Function

Below is the 2010 census data of population change in the US (state-wise).

https://www.census.gov/2010census/csv/pop_change.csv

If you go to this URL, it will open the .csv file that looks as shown below:
IMPORTDATA function in Google Sheets - csv file looks like

It looks like a lot of data with no discernable structure.

If you have to work with this data, it is better to first import it in Google Sheets.

Below is the formula that will get all this data into a worksheet in Google Sheets:

=IMPORTDATA("https://www.census.gov/2010census/csv/pop_change.csv")

Note that you have to enter the entire URL in double-quotes. Also, you need to specify the entire URL, including the ‘http’ or ‘https’ part.

As soon as you enter the formula in Google Sheets, you may see the text ‘Loading’ in the cell. It might take a few seconds to fetch the data and populate the worksheet.

Result of IMPORTDATA function in Google Sheets

There are a couple of important things you need to keep in mind when using the IMPORTDATA function in Google Sheets:

  • The function automatically fills the cells in the worksheet based on the data in the csv/tsv file. In case, some of the cells already have some data, the IMPORTDATA function would return an error. So make sure you have enough empty cells available to accommodate the data from the csv/tsv files.
  • Ensure you’re using the correct version of the URL. If you use ‘http’ instead of ‘https’, it will give you an error.

Example 2 – Fetch Specific Column from a Data using IMPORTDATA Function

If you use the IMPORTDATA function, it will fetch the entire data from the CSV/TSV file into Google Sheets.

But if you’re not interested in the entire data set and only a few columns, you can do that by using a combination of VLOOKUP function with IMPORTDATA.

For example, if you only want the 2010 population data for five specified states, you can use the below formula:

=VLOOKUP(A2,IMPORTDATA(“https://www.census.gov/2010census/csv/pop_change.csv”),12,0)

Fetching specific column data in Google Sheets using IMPORTDATA function

Note that in the above formula, we have used IMPORTDATA function as the table array for the VLOOKUP function. Since we only wanted the data for the 2010 population, we have used 12 as the column number (the third argument of the VLOOKUP function).

You May Also Like the Following Google Sheets Tutorials:

Popular Posts

1 thought on “How to Use IMPORTDATA function in Google Sheets”

  1. Hi thanks for your videos,
    I have a question about data
    Is anyway to figure out how to update the data from excel sheet to a Google sheet when I try the format is so different.
    Thanks

Comments are closed.

Access All

Free Templates

Enjoy our custom-made Google Sheets templates for free via email access