Home » Solve “Loading data may take a while” when using IMPORTDATA in Google Spreadsheets

# Solve “Loading data may take a while” when using IMPORTDATA in Google Spreadsheets

It’s no surprise that I’m a huge fan of GDrive (and basically all of Google’s products). Google Spreadsheets might not be as powerful as Excel, it’s definitely becoming the Swiss-army-knife par excellence for many digital natives. In this blog post how you can import huge amounts of data in a spreadsheet.

An awesome function — in my opinion — is the IMPORTDATA function. It allows you to interact with a variety of data sources, most notable REST API’s.

Yet, the functionality is limited. From the documentation: “A maximum of 50 IMPORTDATA calls are supported on a single spreadsheet.” Once you pass that threshold, you will run into the following error:

“Loading data may take a while because of the large number of requests. Try to reduce the amount of IMPORTHTML, IMPORTDATA, IMPORTFEED or IMPORTXML functions across spreadsheets you’ve created.”

Luckily, there is a way around this: make your own IMPORTDATA function. As suggested in this post on the Google support forums, this is the most generic way to “duplicate” the function and work around the limitations of IMPORTDATA.

function CUSTOMIMPORTDATA(url) {
var response = UrlFetchApp.fetch(url);
var responseData = response.getBlob().getDataAsString();
var data = Utilities.parseCsv(responseData, ',');
return data;
}

Adding your own function can be done as follows. In the menu you go to Tools > Script Editor. You paste the above snippet in the editor (replacing all content) and save it — you have to give your project a name. Now you can use the function CUSTOMIMPORTDATA in your spreadsheet. Don’t worry if you don’t see a tooltip popping up when you type the function.

The functions that you create in the script editor through Google Spreadsheets are bound to that spreadsheet and you as a user. If you want to share your function, you can do so by creating a spreadsheet add-on.

### Say thanks, ask questions or give feedback

Technologies get updated, syntax changes and honestly… I make mistakes too. If something is incorrect, incomplete or doesn’t work, let me know in the comments below and help thousands of visitors.

## 1 thought on “Solve “Loading data may take a while” when using IMPORTDATA in Google Spreadsheets”

1. Exception: Could not parse text. (line 4).