I have the following Google Apps Script that takes a file from the upload form and automatically saves it to my Google Drive (full code in the fragment below). The problem is this section:
var file = folder.createFile(blob);
I use the standard Google App Services createFile method of the createFile class, but it has a small file upload size and it loads very large files very slowly, close to this limit.
Iβd like to move on to advanced Google services that allow you to use the public Google API methods directly in your Google Apps scripts. I have included the Drive API and I think I want to use something like this:
function uploadFile() { var image = UrlFetchApp.fetch('http://goo.gl/nd7zjB').getBlob(); var file = { title: 'google_logo.png', mimeType: 'image/png' }; file = Drive.Files.insert(file, image); Logger.log('ID: %s, File size (bytes): %s', file.id, file.fileSize); }
But I'm struggling to implement it together with my existing code, and all the sample languages ββare designed for these encodings in other languages ββand use the API, and not just in the Script application.
Can someone suggest a code revision needed to use the advanced method, allowing faster and more loading?
google-drive-sdk google-apps-script
astwood
source share