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:

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?

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

  • Rubén, thank you for your quick response; I got the reason as you provided for UrlFetchApp. Could you please share another example of google picker as provided reference is not fit to my problem. – Saad Bin Khalid Feb 6 at 10:06
  • My problem scenario is; I have a google sheet on which links are generating for downloading in G-Drive; I want, when link is generated (after some calculation), I can upload file (from generated link) to directly my G-Drive. – Saad Bin Khalid Feb 6 at 10:09
  • @SaadBinKhalid That is a different question. Please post a new one. – Rubén Feb 6 at 13:17

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.