This is a sample script for uploading files with large size (> 50 MB) at Web Apps using Google Apps Script (GAS). The resumable upload method is used for uploading files. This script can be also applied to the script using gapi of javascript.
At October 11, 2019, I published a Javascript library to to run the resumable upload for Google Drive. When this is used, the large file can be uploaded. You can also use this js library.
This is a sample script for uploading files with large size (> 50 MB) at Web Apps using Google Apps Script (GAS). The resumable upload method is used for uploading files. This script can be also applied to the script using gapi of javascript.
This is a demonstration of this script. As a demonstration, it uploads a file with the size of 100 MB to my Google Drive. When the file was selected, it is uploaded by the resumable upload. It is found that the file can be completely uploaded.
Have you ever thought that you want to upload files with large size from local PC at Web Apps using GAS? Recently, I have thought it. So I investigated about this situation. At first, it was found that there are some limitations for uploading files to Google Drive from local PC.
When users want to upload files with the size more than 50 MB to Google Drive, the Resumable Upload is required to be used. As the next step, although I have looked for the sample script, Unfortunately, I couldn't find it. So I created this. The flow of this sample script is as follows.
If this was useful for you, I'm glad.
There are 2 script files. One is "Code.gs" which is GAS. Another is "index.html" which is HTML including javascript. Please install those as follows.
If you have any questions and commissions for me, feel free to tell me.
v1.0.0 (May 17, 2018)
v1.0.1 (May 18, 2019)
https://www.googleapis.com/auth/drive
.DriveApp.getFiles()
is put in the script, the script editor automatically detects the scope of https://www.googleapis.com/auth/drive
before. But now, When the code of DriveApp.getFiles()
is put in the script, the script editor detects as https://www.googleapis.com/auth/drive.readonly
. By this, when the script is run, an error occurs.https://www.googleapis.com/auth/drive
, I put the code DriveApp.createFile()
instead of DriveApp.getFiles()
as a comment line. By this, I could confirm the script worked fine.