Google drive script won't download file larger than 10MB

I copied a basic example to automatically upload a file to google drive using google-script. Drive.Files.insert works for images (png files) and DriveApp.createFile works for text file types. But I am trying to download a backup.tar.bz2 file that is larger than 10M. Every time the process is executed, it downloads 10 MB and stops. I read somewhere that there is no 10MB limit for non-google file types and I could upload the file as much as I want (1TB I think). I can manually download the same file from google webpage.

Can someone point me in the right direction or give me some sample code that works for> 10MB blob? Thank.

UPDATE: I can download a ZIP file less than 10MB in size.

function uploadFile() {
  var image = UrlFetchApp.fetch('http://example.com/files/backup.tar.bz2').getBlob();
  var file = {
    title: 'backup.tar.bz2',
    mimeType: 'application/bz2'
  };
 // file = Drive.Files.insert(file, image); -- ANOTHER WAY OF DOING IT
    DriveApp.createFile(image);
  //Logger.log('ID: %s, File size (bytes): %s', file.id, file.fileSize);
  Logger.log(image.getName() + "    " + image.getBytes());
};

      

+3


source to share


1 answer


I'm afraid the DriveApp.createFile documentation mentions

Throws an exception if the content is more than 10 MB



for all options except Blob

, but I suspect this is just an oversight. This is similar to the POST quota and is mentioned anyway in several support tickets (see for example # 552 , # 2806 ).

0


source







All Articles