What alternatives do I have when encountering IMPORTDATA maximum size error in Google Sheets?

Viewed 5610

I'm using the IMPORTDATA formula to populate a CSV file. I'm encountering an Error.

The file size is 8MB so I think that may be the issue since I've previously used this formula with no problems, do I have any alternative routes to populate this data into the sheet?

This is the formula I am using:

=IMPORTDATA("URL.csv")

I expect the entire file to upload but am encountering the error message:

Error The resource at URL contents exceeded the maximum size.

2 Answers

Please try this code:

function getBigCsv() {
  var url = 'https:URL.csv';
  var csv = UrlFetchApp.fetch(url);
  var data = Utilities.parseCsv(csv);
  SpreadsheetApp.getActive().getSheetByName('Sheet1').getRange(2, 1, data.length, data[0].length).setValues(data);
}

try something like this:

={ARRAY_CONSTRAIN(IMPORTDATA("URL.csv"), 1000, 1); 
 QUERY(IMPORTDATA("URL.csv"), "offset 1000", 0)}

which translates as: if 2000 rows throw you an error then import 1000 rows and then import another 1000 under it

Related