how can I use uploadtype resumable in Drive.Files.insert()

251 views
Skip to first unread message

shu nishi

unread,
May 7, 2020, 9:29:06 PM5/7/20
to Google Apps Script Community

I try to use Drive.Files.insert() for making more than 50mb csv in Google app script.(using Drve API)
the error message is Empty response. 
I read reference but there is no answer to do that.
here is code. 

 var optionalArgs = { 
     uploadType: 'resumable',
    }; 
 var resource = {
                     title: fileName,
                     parents: [],
     };
 Drive.Files.insert(resource, blob, optionalArgs);

thank you for reading my message.

Martin Hawksey

unread,
May 8, 2020, 8:37:17 AM5/8/20
to Google Apps Script Community
not something I've had to do personally but I know some extra work is required when doing this with Google Apps Script. You might want to look at the example of resumable upload Bruce Mcpherson has documented (for this you will need to use his cUseful library) https://sites.google.com/a/mcpher.com/share/Home/excelquirks/gassnips/resumable. Another solution published by the community comes from Tanaike which uses HTMLSerivce (dialog/sidebar/webapp) for handling the upload https://github.com/tanaikech/AsynchronousResumableUploadForGoogleDrive 

skyblue

unread,
May 8, 2020, 9:51:16 PM5/8/20
to Google Apps Script Community
thank you for sending a message.
I appreciate that. can you tell me how to use  cUseful library if you know that. (I try to find library key but I can not find that so I cannnot use his library)



2020年5月8日金曜日 21時37分17秒 UTC+9 Martin Hawksey:

Martin Hawksey

unread,
May 9, 2020, 4:18:48 AM5/9/20
to Google Apps Script Community
Hi,

This page references the cUseful library key https://ramblings.mcpher.com/google-apps-scripts-snippets-2/zipping-to-make-stuff-fit-in-cache-or-properties-service/

Also if you prefer you could copy/paste the FetchUtils method source code which is included at the end of the post I originally shared.

Happy scripting
Martin

skyblue

unread,
May 9, 2020, 8:57:29 AM5/9/20
to Google Apps Script Community
Im really appreciate Martin!
I use that library and make more than 50mb csv file in google drive.

thank you so much

2020年5月9日土曜日 17時18分48秒 UTC+9 Martin Hawksey:

Faustino Rodriguez

unread,
Jul 24, 2020, 8:28:48 PM7/24/20
to Google Apps Script Community
Is any of these libraries using Drive.Files.insert() advanced service?
- I had a quick look but only see DriveApp references
- And I would need to use the Drive.Files.insert() call

Thanks in advance

Reply all
Reply to author
Forward
0 new messages