Google-apps-script – Upload Limit of Drive.File.Insert

google-apps-scriptgoogle-drive

While I use the following app script code to upload file from URL to GDrive it is executed flawless but when I change the source URL with a large file's URL (more than 1GB) it uploads only 50MB for that file.

function uploadFile() {
  var URL = UrlFetchApp.fetch('https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png').getBlob();
  var file = {
    title: 'google_logo.png',
  };
  file = Drive.Files.insert(file, URL);
}

e.g. change lines of above code with following:

UrlFetchApp.fetch('http://director.downloads.raspberrypi.org/raspbian_full/images/raspbian_full-2018-11-15/2018-11-13-raspbian-stretch-full.zip').getBlob();
title: '2018-11-13-raspbian-stretch-full.zip',

It uploads only 50MB.

  • So, what is the maximum uploading limit (as mentioned in reference
    documents it is 5120GB)?
  • Is this method only for dealing Docs,
    Sheets, Slides, etc. files? if yes than how to deal with other file
    types?

Best Answer

URL Fetch response size (UrlFetchApp) has a 50MB limit per call. Ref. https://developers.google.com/apps-script/guides/services/quotas

Instead of using UrlFetchApp use Google Picker. See https://developers.google.com/apps-script/guides/dialogs#file-open_dialogs