5

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.

player0
  • 124,011
  • 12
  • 67
  • 124
Luis
  • 75
  • 1
  • 5

2 Answers2

2

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);
}
Max Makhrov
  • 17,309
  • 5
  • 55
  • 81
0

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

player0
  • 124,011
  • 12
  • 67
  • 124
  • Thanks for the help! I tried that and actually received the same error. – Luis Jun 26 '19 at 20:48
  • Here is the sheet! the file is within cell A1. thanks for the help! https://docs.google.com/spreadsheets/d/1kHxy01qXgm0MBv3Jz3BB1jTqGjx5yRXPwVx4E6b-5CI/edit?usp=sharing – Luis Jun 26 '19 at 21:11
  • the issue is that the link is direct download. do you have a regular link which can be visited in the browser? – player0 Jun 26 '19 at 21:54
  • i've tried the same type of link with a previous file and that worked fine so i dont think the regular link where it can be visited in the browser would be the issue. do you think that would be it? – Luis Jun 26 '19 at 21:58