Google Sheets Functions for the Advanced Online Marketers – Part II: IMPORTDATA

Whether you regularly connect various spreadsheets to create impressive reports or only use Google Sheets once a month to update numbers, every online marketer should have the following Google Sheets functions in their toolbox.

These functions are not only incredibly useful for efficiently performing calculations in your spreadsheets, but they also open up new possibilities, allowing you to automate more tasks and achieve even better results.

We’re staying close to the basics with Part II: The IMPORTDATA function. This function, along with IMPORTRANGE and IMPORTXML , allows you to easily import data from an external source into your Google Spreadsheet.

IMPORTRANGE/ IMPORTDATA/ IMPORTXML

What is IMPORTDATA used for?

If you want to link data from an external source, such as a Custom CSV feed from Channable, or a sheet from another Google Sheet, you can use IMPORTRANGE, IMPORTDATA, or IMPORTXML to easily load that data into your spreadsheet.

This is helpful when you want to enrich that data or combine multiple data sources.

How do you use IMPORTDATA?

The structure is simple: you select a URL containing data and then specify the range (IMPORTRANGE), a delimiter (IMPORTDATA), or an xpath-query (IMPORTXML), depending on the function used. And voilà, your data appears in your spreadsheet, ready to be used in other formulas.

For example: =IMPORTDATA(“https://files.channable.com/YKbk8i_1r8uNb2Onz6Hg6LDbA==.csv”,”;”)

This function retrieves a CSV from Channable, where a semicolon is set as the delimiter. The data is then displayed as a table in your spreadsheet, ready to be used in other formulas.

IMPORTDATA Bonus Tip 1A:

You can easily export Google Sheets spreadsheets to a CSV URL (via File > Share > Publish to the web). Select the tab you want to export and choose the Comma Separated Values (CSV) option. You’ll then receive a URL that you can import into Channable or use as input in an Apps Script.

IMPORTDATA Bonus Tip 1B:

Want to trace the source of such a CSV URL or view the data without downloading the CSV? Simply change the parameter output=csv in the URL to output=html. At the top, you’ll see {Spreadsheet name} : {Sheet name} and can use the Spreadsheet name to search for the file in https://docs.google.com/spreadsheets/u/0/ (as long as you have access, of course).

IMPORTDATA Bonus Tip 2:

The IMPORTDATA and IMPORTXML functions have a limit of 5 million cells. If, for example, you’re trying to import a sitemap.xml with tens of thousands of URLs, you may encounter an error. The best solution is to use a Google Apps Script that retrieves the data and pastes it as values into your spreadsheet.

The advantage is that when loading your spreadsheet, all imports don’t have to refresh. However, the downside is that the data becomes static, and you’ll need to run the Apps Script periodically to keep the data up to date.

IMPORTDATA Bonus Tip 3:

Since these functions populate multiple cells and columns from a single cell, it’s a good idea to mark the source cell (where the formula is located) in yellow and the cells it fills in light orange (see the example above).

This prevents you from accidentally editing values that fall within this result vector, which could lead to #REF! errors. If you use several of these formulas next to each other, use slightly different shades of orange or other colors for each result vector.

IMPORTDATA Bonus Tip 4:

You probably want the data you import via the IMPORTDATA function to refresh periodically. This happens automatically when you reopen the spreadsheet, but it’s useful to know that Google Sheets refreshes these functions at the following intervals:

  • IMPORTRANGE: every 30 minutes
  • IMPORTDATA, IMPORTXML: every 1 hour

If you want to refresh the data more frequently, you can manually refresh the cell's content (for example, by adding a space after the URL). Alternatively, you can use an Apps Script that clears the cell and then re-inserts the formula (which has the same effect as manual refreshing).

IMPORTDATA Bonus Tip 5:

Since the data you import through these functions is dynamic, you should avoid adding columns with static data to it. When a row is inserted during the next refresh, the data in your columns will no longer align with the data in the imported sources.

To solve this, use a separate tab where you enrich the existing static columns with an XLOOKUP from the data in your dynamic source (by matching them based on a unique identifier).